Refactor import order and remove unnecessary samesite attribute in set_cookie() calls
This commit is contained in:
parent
fc7bcf53c9
commit
e011d1f6dc
1 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
from fastapi import Request, Response, APIRouter, Depends, HTTPException, status
|
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
|
||||||
from fastapi.security import OAuth2PasswordRequestForm
|
from fastapi.security import OAuth2PasswordRequestForm
|
||||||
from sqlmodel import Session
|
from sqlmodel import Session
|
||||||
|
|
||||||
|
|
@ -33,8 +33,8 @@ async def login_to_get_access_token(
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
tokens = create_user_tokens(user_id=user.id, db=db, update_last_login=True)
|
tokens = create_user_tokens(user_id=user.id, db=db, update_last_login=True)
|
||||||
response.set_cookie("refresh_token_lf", tokens["refresh_token"], httponly=True, secure=True, samesite="strict")
|
response.set_cookie("refresh_token_lf", tokens["refresh_token"], httponly=True, secure=True)
|
||||||
response.set_cookie("access_token_lf", tokens["access_token"], httponly=False, secure=True, samesite="strict")
|
response.set_cookie("access_token_lf", tokens["access_token"], httponly=False, secure=True)
|
||||||
return tokens
|
return tokens
|
||||||
else:
|
else:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue