Auth0 API Python SDK

raw JSON →
1.0.0b9 verified Sat May 09 auth: no python

Auth0's official SDK for verifying access tokens and securing Python APIs using Authlib. Current version: 1.0.0b9 (beta). Release cadence: periodic, pre-release stage.

pip install auth0-api-python
error ModuleNotFoundError: No module named 'auth0_api_python'
cause SDK not installed or installed under a different name.
fix
Run: pip install auth0-api-python
error AttributeError: module 'auth0_api_python' has no attribute 'TokenVerifier'
cause Wrong import path; TokenVerifier is in token_verifier submodule.
fix
Use: from auth0_api_python.token_verifier import TokenVerifier
error auth0_api_python.exceptions.Auth0APIError: Failed to fetch JWKS: HTTPSConnectionPool...
cause Network issue or invalid domain; domain not reachable.
fix
Verify AUTH0_DOMAIN is correct and your environment can reach https://{domain}/.well-known/openid-configuration
error auth0_api_python.exceptions.Auth0APIError: Token verification failed: Signature verification failed
cause Token is not signed with the expected algorithm or key.
fix
Ensure token was issued by your Auth0 tenant and the algorithms parameter matches (e.g., algorithms=['RS256']). Check token's header for algorithm.
gotcha The SDK is in beta (1.0.0b9). APIs may change without warning. Pin to exact version in production.
fix Pin to exact version: auth0-api-python==1.0.0b9
breaking The import path for TokenVerifier changed from auth0_api_python to auth0_api_python.token_verifier in the beta releases. Using the old path will raise ImportError.
fix Use: from auth0_api_python.token_verifier import TokenVerifier
gotcha The SDK requires Authlib which has its own version constraints. Ensure your environment has compatible Authlib version (>=0.15, <1.0).
fix Check Authlib version: pip show authlib. If incompatible, upgrade: pip install 'authlib>=0.15,<1.0'
gotcha TokenVerifier.verify() does NOT validate the token's expiration (exp claim) automatically. You must check it yourself.
fix After verify(), check payload['exp'] against current time: if payload['exp'] < time.time(): raise ...
pip install auth0-api-python==1.0.0b9

Initialize a TokenVerifier with your Auth0 domain and audience, then call verify() on a token.

import os
from auth0_api_python.token_verifier import TokenVerifier

domain = os.environ.get('AUTH0_DOMAIN', 'your-tenant.auth0.com')
audience = os.environ.get('AUTH0_AUDIENCE', 'https://your-api')

verifier = TokenVerifier(
    domain=domain,
    audience=audience,
    algorithms=['RS256']
)

token = "your_access_token"  # from Authorization header
payload = verifier.verify(token)
print(payload)