Add access token as a cookie in auto_login endpoint
This commit is contained in:
parent
e9f5ad4017
commit
d042b28c52
1 changed files with 6 additions and 2 deletions
|
|
@ -45,9 +45,13 @@ async def login_to_get_access_token(
|
||||||
|
|
||||||
|
|
||||||
@router.get("/auto_login")
|
@router.get("/auto_login")
|
||||||
async def auto_login(db: Session = Depends(get_session), settings_service=Depends(get_settings_service)):
|
async def auto_login(
|
||||||
|
response: Response, db: Session = Depends(get_session), settings_service=Depends(get_settings_service)
|
||||||
|
):
|
||||||
if settings_service.auth_settings.AUTO_LOGIN:
|
if settings_service.auth_settings.AUTO_LOGIN:
|
||||||
return create_user_longterm_token(db)
|
tokens = create_user_longterm_token(db)
|
||||||
|
response.set_cookie("access_token_lf", tokens["access_token"], httponly=False, secure=True, samesite="strict")
|
||||||
|
return tokens
|
||||||
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue