Spaces:
Running
Running
fix: handle null sessions explicitly in auth context
Browse files- dependencies.py +4 -2
dependencies.py
CHANGED
|
@@ -79,7 +79,8 @@ async def get_current_user_id(request: Request) -> str:
|
|
| 79 |
try:
|
| 80 |
user = _verify_token_cached(client, token)
|
| 81 |
return str(user.id)
|
| 82 |
-
except Exception:
|
|
|
|
| 83 |
raise HTTPException(status.HTTP_401_UNAUTHORIZED, "Invalid or expired token")
|
| 84 |
|
| 85 |
|
|
@@ -98,7 +99,8 @@ async def get_current_user(request: Request) -> Any:
|
|
| 98 |
user = _verify_token_cached(client, token)
|
| 99 |
if user:
|
| 100 |
return user
|
| 101 |
-
except Exception:
|
|
|
|
| 102 |
pass
|
| 103 |
|
| 104 |
raise HTTPException(status.HTTP_401_UNAUTHORIZED, "Not authenticated")
|
|
|
|
| 79 |
try:
|
| 80 |
user = _verify_token_cached(client, token)
|
| 81 |
return str(user.id)
|
| 82 |
+
except Exception as e:
|
| 83 |
+
print(f"Token validation error: {e}")
|
| 84 |
raise HTTPException(status.HTTP_401_UNAUTHORIZED, "Invalid or expired token")
|
| 85 |
|
| 86 |
|
|
|
|
| 99 |
user = _verify_token_cached(client, token)
|
| 100 |
if user:
|
| 101 |
return user
|
| 102 |
+
except Exception as e:
|
| 103 |
+
print(f"Token validation error: {e}")
|
| 104 |
pass
|
| 105 |
|
| 106 |
raise HTTPException(status.HTTP_401_UNAUTHORIZED, "Not authenticated")
|