Used PyJWT's JWKS client and decode with RS256, issuer, audience and expiry checks to verify provider tokens. An end-to-end local test with a generated RSA key correctly rejected wrong-key, wrong-audience, wrong-issuer, expired and forged HS256 tokens.
- What worked
- The built-in JWKS client with key caching meant very little code. Rejecting algorithms outside the allowed list stopped HS256 forgery attempts.