Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- backend/auth_cookie.py +9 -1
backend/auth_cookie.py
CHANGED
|
@@ -161,7 +161,15 @@ async def auth_signup(body: SignupBody, response: Response):
|
|
| 161 |
|
| 162 |
|
| 163 |
@router.post("/logout")
|
| 164 |
-
async def auth_logout(response: Response):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
_clear_session_cookies(response)
|
| 166 |
return {"ok": True}
|
| 167 |
|
|
|
|
| 161 |
|
| 162 |
|
| 163 |
@router.post("/logout")
|
| 164 |
+
async def auth_logout(request: Request, response: Response):
|
| 165 |
+
# Invalidate the session server-side before clearing cookies
|
| 166 |
+
token = extract_token(request)
|
| 167 |
+
if token:
|
| 168 |
+
try:
|
| 169 |
+
client = _anon_supabase()
|
| 170 |
+
client.auth.sign_out(token)
|
| 171 |
+
except Exception:
|
| 172 |
+
pass # Still clear cookies even if server-side invalidation fails
|
| 173 |
_clear_session_cookies(response)
|
| 174 |
return {"ok": True}
|
| 175 |
|