This commit is contained in:
Timothy Jaeryang Baek
2026-02-19 16:29:19 -06:00
parent 6ac593209c
commit 91a0301c9e
3 changed files with 447 additions and 0 deletions
+4
View File
@@ -290,6 +290,10 @@ async def get_current_user(
if token is None and "token" in request.cookies:
token = request.cookies.get("token")
# Fallback to request.state.token (set by middleware, e.g. for x-api-key)
if token is None and hasattr(request.state, "token") and request.state.token:
token = request.state.token.credentials
if token is None:
raise HTTPException(status_code=401, detail="Not authenticated")