feat: improve auth error logging with exception type details
Some checks failed
CI / lint-and-test (push) Has been cancelled

This commit is contained in:
2026-04-14 16:33:32 +02:00
parent b35cac42e0
commit 0bdfae6373

View File

@@ -68,8 +68,8 @@ def _decode_token(token: str, jwks):
except HTTPException:
raise
except Exception as exc:
logger.warning("Token verification failed", error=str(exc))
raise HTTPException(status_code=401, detail="Invalid token") from None
logger.warning("Token verification failed", error_type=type(exc).__name__, error=str(exc))
raise HTTPException(status_code=401, detail=f"Invalid token ({type(exc).__name__})") from None
def require_auth(authorization: str | None = Header(None)):