fix: add logging to debug auth issues
All checks were successful
CI / backend-tests (push) Successful in 29s
CI / frontend-tests (push) Successful in 28s

This commit is contained in:
2026-03-22 12:01:28 +01:00
parent ce9d08963f
commit fde1867863
2 changed files with 13 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
import logging
from dataclasses import dataclass
from uuid import UUID
@@ -12,6 +13,7 @@ from app.core.database import get_session
from app.models.nuzlocke_run import NuzlockeRun
from app.models.user import User
logger = logging.getLogger(__name__)
_jwks_client: PyJWKClient | None = None
@@ -71,12 +73,14 @@ def _verify_jwt(token: str) -> dict | None:
algorithms=["RS256", "ES256"],
audience="authenticated",
)
except jwt.InvalidTokenError:
pass
except PyJWKClientError:
pass
except PyJWKSetError:
pass
except jwt.InvalidTokenError as e:
logger.warning("JWKS JWT validation failed: %s", e)
except PyJWKClientError as e:
logger.warning("JWKS client error: %s", e)
except PyJWKSetError as e:
logger.warning("JWKS set error: %s", e)
else:
logger.debug("No JWKS client available (SUPABASE_URL not set?)")
return _verify_jwt_hs256(token)