ritesh19180 commited on
Commit
4e68ae5
·
verified ·
1 Parent(s): 4edc045

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. 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