jwt
JSON Web Token library for Python 3.
What it is and what it does
python-jwt is a JSON Web Token implementation for Python that handles the full lifecycle of JWT creation and validation. It provides a JWT class for encoding messages into signed tokens and decoding them with signature verification, supporting both symmetric algorithms (HS256, HS384, HS512) and asymmetric algorithms (RS256, RS384, RS512, PS256, PS384, PS512). The library integrates with the cryptography package for key management and can load keys from JWK dictionaries or PEM files.
The package is designed for authentication and authorization workflows where you need to create tamper-proof tokens, verify their signatures, and validate claims like expiration time. It follows the JWT specification and includes utilities for working with datetime objects in token claims. The library is marked Production/Stable and supports Python 3.9 and later versions.
Use it for:
- Build stateless authentication systems where tokens are signed and verified without server-side session storage
- Implement OAuth 2.0 or OpenID Connect flows requiring JWT access and ID tokens
- Create API authentication where clients include signed tokens in request headers
- Validate third-party tokens from external identity providers using their public keys
- Secure inter-service communication in microservices by signing and verifying service-to-service tokens
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Encodes and decodes JSON Web Tokens (JWTs) with signature verification, supporting symmetric and asymmetric algorithms including RS256, HS256, and PS256.
Yes. The package offers a straightforward, production-stable JWT implementation with low install friction and no known vulnerabilities. It covers the core JWT use cases with support for modern algorithms and key formats. The aging maintenance status (last commit 417 days ago) is not a blocker for a stable, mature library, but indicates you should not expect frequent feature additions—suitable if you need reliable JWT handling without expecting active development.
Install
jwt on PyPI
pip
pip install jwtuv
uv add jwtpoetry
poetry add jwtInstalling jwt
Before you install
Low install friction with a single cryptography dependency. The package is marked as Production/Stable and has received a release within the last year, though the last commit was 417 days ago, suggesting the project is in maintenance mode rather than active development.
License in practice
Licensed under Apache License 2.0 (permissive), which allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install jwt
from jwt import JWT, jwk_from_dict
from datetime import datetime, timedelta, timezone
from jwt.utils import get_int_from_datetime
instance = JWT()
message = {'iss': 'https://example.com/', 'sub': 'user', 'exp': get_int_from_datetime(datetime.now(timezone.utc) + timedelta(hours=1))}
signing_key = jwk_from_dict({'kty': 'oct', 'k': 'secret'})
token = instance.encode(message, signing_key, alg='HS256')
Requires Python 3.9 or later; cryptography library must be installed.
Verify before relying
- Whether the package handles JWT refresh tokens or only access tokens
- Performance characteristics when encoding/decoding high volumes of tokens
- Support for custom claims validation beyond standard time checks
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — cryptography |
| Maintenance | aging — 417 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,781,603/month — #2,499 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jwt-1.4.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
python-jwtGenerates and verifies JSON Web Tokens (JWTs)…
permissive · top 15,000 on PyPI
python-joseImplements JOSE (JSON Object Signing and…
permissive · top 1,000 on PyPI
PyJWTPyJWT encodes and decodes JSON Web Tokens (JWT)…
permissive · top 100 on PyPI
jwskateImplements the JOSE family of IETF standards…
permissive · top 5,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
pyjwkestImplements JWT, JWS, JWE, and JWK standards for…
permissive · top 15,000 on PyPI
joseImplements JSON Web Signature (JWS) and JSON…
permissive · top 15,000 on PyPI
myjwtA command-line tool for testing and…
permissive · top 15,000 on PyPI
standardwebhooksProvides webhook payload verification and…
permissive · top 5,000 on PyPI
json-timeseriesConstructs, manipulates, and serializes time…
permissive · top 15,000 on PyPI