fix: catch PyJWKSetError in JWT verification fallback
All checks were successful
CI / backend-tests (push) Successful in 29s
CI / frontend-tests (push) Successful in 28s

PyJWKSetError is not a subclass of PyJWKClientError — they are siblings
under PyJWTError. The empty JWKS key set error was not being caught.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 09:56:58 +01:00
parent 94cc74c0fb
commit ac0a04e71f

View File

@@ -3,7 +3,7 @@ from uuid import UUID
import jwt
from fastapi import Depends, HTTPException, Request, status
from jwt import PyJWKClient, PyJWKClientError
from jwt import PyJWKClient, PyJWKClientError, PyJWKSetError
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
@@ -75,6 +75,8 @@ def _verify_jwt(token: str) -> dict | None:
pass
except PyJWKClientError:
pass
except PyJWKSetError:
pass
return _verify_jwt_hs256(token)