Skip to main content

Auth0 integration library for Python

Project description

pyauth0

Library for Auth0 token validation.

Usage

from pyauth0 import Auth0, Auth0Error

auth0 = Auth0(
    auth0_domain="your-tenant-dev.us.pyauth0.com",
    api_audience="https://api-dev.your-tenant.com",
    jwks_cache_ttl=60,  # optional
)
try:
    token_payload = auth0.validate_auth_header(
        "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
    )
except Auth0Error as error:
    status_code = error.status_code  # suggested status code (401 or 403)
    code = error.code  # pyauth0 error code (example "invalid_header")
    description = error.description  # pyauth0 error description (example "Unable to parse authentication token")
    raise

claim_value = token_payload.get_claim("http://your-tenant.com/claim_name", "default value")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyauth0-0.0.2-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page