Spaces:
Sleeping
Sleeping
Update src/routers/auth.py
Browse files- src/routers/auth.py +4 -4
src/routers/auth.py
CHANGED
|
@@ -57,7 +57,7 @@ def register(user_data: RegisterRequest, response: Response, session: Session =
|
|
| 57 |
value=access_token,
|
| 58 |
httponly=True,
|
| 59 |
secure=settings.JWT_COOKIE_SECURE, # True in production, False in development
|
| 60 |
-
samesite="
|
| 61 |
max_age=settings.ACCESS_TOKEN_EXPIRE_DAYS * 24 * 60 * 60, # Convert days to seconds
|
| 62 |
path="/"
|
| 63 |
)
|
|
@@ -93,14 +93,14 @@ def login(login_data: LoginRequest, response: Response, session: Session = Depen
|
|
| 93 |
value=access_token,
|
| 94 |
httponly=True,
|
| 95 |
secure=settings.JWT_COOKIE_SECURE, # True in production, False in development
|
| 96 |
-
samesite="
|
| 97 |
max_age=settings.ACCESS_TOKEN_EXPIRE_DAYS * 24 * 60 * 60, # Convert days to seconds
|
| 98 |
path="/"
|
| 99 |
)
|
| 100 |
|
| 101 |
# Debug: Print the cookie being set
|
| 102 |
print(f"Setting cookie: access_token={access_token}")
|
| 103 |
-
print(f"Cookie attributes: httponly={True}, secure={settings.JWT_COOKIE_SECURE}, samesite=
|
| 104 |
|
| 105 |
# Return response
|
| 106 |
return LoginResponse(
|
|
@@ -123,7 +123,7 @@ def logout(response: Response):
|
|
| 123 |
value="",
|
| 124 |
httponly=True,
|
| 125 |
secure=settings.JWT_COOKIE_SECURE,
|
| 126 |
-
samesite="
|
| 127 |
max_age=0, # Expire immediately
|
| 128 |
path="/"
|
| 129 |
)
|
|
|
|
| 57 |
value=access_token,
|
| 58 |
httponly=True,
|
| 59 |
secure=settings.JWT_COOKIE_SECURE, # True in production, False in development
|
| 60 |
+
samesite="none", # Allow cross-site cookies; browsers require Secure for SameSite=None
|
| 61 |
max_age=settings.ACCESS_TOKEN_EXPIRE_DAYS * 24 * 60 * 60, # Convert days to seconds
|
| 62 |
path="/"
|
| 63 |
)
|
|
|
|
| 93 |
value=access_token,
|
| 94 |
httponly=True,
|
| 95 |
secure=settings.JWT_COOKIE_SECURE, # True in production, False in development
|
| 96 |
+
samesite="none", # Allow cross-site cookies; browsers require Secure for SameSite=None
|
| 97 |
max_age=settings.ACCESS_TOKEN_EXPIRE_DAYS * 24 * 60 * 60, # Convert days to seconds
|
| 98 |
path="/"
|
| 99 |
)
|
| 100 |
|
| 101 |
# Debug: Print the cookie being set
|
| 102 |
print(f"Setting cookie: access_token={access_token}")
|
| 103 |
+
print(f"Cookie attributes: httponly={True}, secure={settings.JWT_COOKIE_SECURE}, samesite=none, max_age={settings.ACCESS_TOKEN_EXPIRE_DAYS * 24 * 60 * 60}")
|
| 104 |
|
| 105 |
# Return response
|
| 106 |
return LoginResponse(
|
|
|
|
| 123 |
value="",
|
| 124 |
httponly=True,
|
| 125 |
secure=settings.JWT_COOKIE_SECURE,
|
| 126 |
+
samesite="none", # Allow cross-site cookies; browsers require Secure for SameSite=None
|
| 127 |
max_age=0, # Expire immediately
|
| 128 |
path="/"
|
| 129 |
)
|