🔧 chore(login.py): import get_current_active_user function to improve code readability and maintainability
✨ feat(login.py): add current_user dependency to refresh_token endpoint to ensure only authenticated users can refresh their tokens
This commit is contained in:
parent
132642347f
commit
89ea8e45f6
1 changed files with 4 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ from langflow.services.auth.utils import (
|
|||
create_user_tokens,
|
||||
create_refresh_token,
|
||||
create_user_longterm_token,
|
||||
get_current_active_user,
|
||||
)
|
||||
|
||||
from langflow.services.utils import get_settings_manager
|
||||
|
|
@ -49,7 +50,9 @@ async def auto_login(db: Session = Depends(get_session)):
|
|||
|
||||
|
||||
@router.post("/refresh")
|
||||
async def refresh_token(token: str):
|
||||
async def refresh_token(
|
||||
token: str, current_user: Session = Depends(get_current_active_user)
|
||||
):
|
||||
if token:
|
||||
return create_refresh_token(token)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue