Metadata-Version: 2.4
Name: auth0-jwt-validator
Version: 1.2.1
Summary: A JWT python package to validate tokens, scopes and permissions for Auth0 tokens.
Keywords: auth0,jwt,jwks,oauth2,openid-connect,token-validation
Author: dbritto-dev
Author-email: dbritto-dev <dbritto.dev@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: authlib>=1.8.0
Requires-Dist: bandit>=1.9.4 ; extra == 'dev'
Requires-Dist: coverage>=7.16.0 ; extra == 'dev'
Requires-Dist: nox>=2026.8.17 ; extra == 'dev'
Requires-Dist: pytest>=9.1.1 ; extra == 'dev'
Requires-Dist: pytest-cov>=7.1.0 ; extra == 'dev'
Requires-Dist: ruff>=0.16.6 ; extra == 'dev'
Requires-Dist: safety>=3.8.1 ; extra == 'dev'
Requires-Dist: ty>=0.0.78 ; extra == 'dev'
Requires-Dist: ruff>=0.16.6 ; extra == 'lint'
Requires-Dist: bandit>=1.9.4 ; extra == 'security-test'
Requires-Dist: safety>=3.8.1 ; extra == 'security-test'
Requires-Dist: coverage>=7.16.0 ; extra == 'test'
Requires-Dist: nox>=2026.8.17 ; extra == 'test'
Requires-Dist: pytest>=9.1.1 ; extra == 'test'
Requires-Dist: pytest-cov>=7.1.0 ; extra == 'test'
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/dbritto-dev/auth0-jwt-validator-python
Project-URL: Repository, https://github.com/dbritto-dev/auth0-jwt-validator-python
Project-URL: Issues, https://github.com/dbritto-dev/auth0-jwt-validator-python/issues
Provides-Extra: dev
Provides-Extra: lint
Provides-Extra: security-test
Provides-Extra: test
Description-Content-Type: text/markdown

# Auth0 JWT Validator

A JWT python package to validate tokens, scopes and permissions for Auth0 tokens.

- **Bug reports:** https://github.com/dbritto-dev/auth0-jwt-validator-python/issues
- **Source code:** https://github.com/dbritto-dev/auth0-jwt-validator-python

## Installation

### Install with uv

```sh
uv add auth0-jwt-validator
```

### Install with pip

```sh
pip install auth0-jwt-validator
```

## Requirements

- Python 3.10 or later

## Usage

### Validating an ID Token

```python
from auth0_jwt_validator import IdTokenVerifier

auth0_jwks_uri = "https://<auth0-tenant>.us.auth0.com/.well-known/jwks.json"
issuer = "https://<auth0-tenant>.us.auth0.com/"
audience = "https://<auth0-tenant>.us.auth0.com/api/v2/"

token_verifier = IdTokenVerifier(auth0_jwks_uri, issuer, audience)
token_verifier.verify("some-id-token")
```

The `verify` method also accepts `nonce`, `max_age` and `organization` to validate the
matching claims:

```python
token_verifier.verify("some-id-token", nonce="some-random-string")
token_verifier.verify("some-id-token", max_age=60 * 60 * 24)
token_verifier.verify("some-id-token", organization="some-organization")
```

### Validating an Access Token

```python
from auth0_jwt_validator import AccessTokenVerifier

auth0_jwks_uri = "https://<auth0-tenant>.us.auth0.com/.well-known/jwks.json"
issuer = "https://<auth0-tenant>.us.auth0.com/"
audience = "https://<auth0-tenant>.us.auth0.com/api/v2/"

token_verifier = AccessTokenVerifier(auth0_jwks_uri, issuer, audience)
token_verifier.verify("some-access-token")
```

The `verify` method also accepts `organization`, `required_scopes` and `required_permissions`:

```python
token_verifier.verify("some-access-token", organization="some-organization")
token_verifier.verify("some-access-token", required_scopes=["profile", "calendar"])
token_verifier.verify("some-access-token", required_permissions=["read:user", "delete:user"])
```

### Extracting a bearer token from a header

```python
from auth0_jwt_validator import get_token

get_token("Bearer super-secret-token")  # "super-secret-token"
```

Both verifiers raise `authlib.jose.errors.MissingClaimError` or
`authlib.jose.errors.InvalidClaimError` (re-exported from this package) when a claim is
missing or does not match the expected value.

## Development

This project uses [uv](https://docs.astral.sh/uv/) to manage dependencies and packaging.

```sh
uv sync --extra dev
```

Common tasks are wired up through [nox](https://nox.thea.codes/):

```sh
uvx nox -s lint
uvx nox -s test
uvx nox -s type_check
uvx nox -s security_test
```

## License

MIT — see [LICENSE](LICENSE).
