Getting Started¶
Requirements¶
- Python
>=3.10
Installation¶
Install only the sync verifier:
Install async support:
Install framework helpers:
First Sync Verification¶
from oidc_jwt_verifier import AuthConfig, JWTVerifier
config = AuthConfig(
issuer="https://issuer.example/",
audience="https://api.example",
jwks_url="https://issuer.example/.well-known/jwks.json",
)
verifier = JWTVerifier(config)
claims = verifier.verify_access_token(token)
First Async Verification¶
from oidc_jwt_verifier import AuthConfig
from oidc_jwt_verifier.async_verifier import AsyncJWTVerifier
config = AuthConfig(
issuer="https://issuer.example/",
audience="https://api.example",
jwks_url="https://issuer.example/.well-known/jwks.json",
)
async def verify(token: str) -> dict[str, object]:
async with AsyncJWTVerifier(config) as verifier:
return await verifier.verify_access_token(token)
Note: In production services, prefer reusing a single AsyncJWTVerifier
instance for the app/process lifetime and close it on shutdown.
Next Steps¶
- Configure claim and cache behavior: Configuration
- Handle verifier errors correctly: Errors
- Integrate with your framework:
- FastAPI
- Starlette