python-jose
A JOSE implementation in Python for JWS, JWE, JWK, and JWT signing/encryption
Repository Health
Technical Analysis
python-jose is a Python implementation of the JavaScript Object Signing and Encryption (JOSE) family of standards — JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), and JSON Web Algorithm (JWA) — including a high-level jwt module for encoding and decoding JSON Web Tokens. It supports three interchangeable cryptographic backends (pyca/cryptography, pycryptodome, and a pure-Python native backend), letting applications choose their dependency footprint while keeping the same public API.
Because JWT-based authentication is ubiquitous in modern APIs and single-sign-on flows, python-jose is a common building block for verifying and issuing tokens in Python web frameworks, OAuth2/OIDC clients, and API gateways that need to validate signed or encrypted tokens from identity providers like Auth0, Okta, or a custom OAuth2 server.
What You Get
- A high-level
jwt.encode()/jwt.decode()API supporting standard claims validation (expiry, audience, issuer) out of the box - Lower-level
jwsandjwemodules for direct JSON Web Signature and JSON Web Encryption operations when the high-level JWT API isn’t sufficient jwksupport for representing and loading RSA, EC, and symmetric keys, including JWK Set (JWKS) parsing for identity-provider public key rotation- Three swappable cryptographic backends — pyca/cryptography (recommended), pycryptodome, and a dependency-light pure-Python native backend — selected via install extras
- Support for the full range of JOSE algorithms including RS256/384/512, ES256/384/512, HS256/384/512, and encryption algorithms for JWE
Common Use Cases
- Verifying JWT access tokens issued by an OAuth2/OIDC identity provider (Auth0, Okta, AWS Cognito) in a Python API backend
- Issuing signed JWTs for a custom authentication system, embedding claims like user ID, roles, and expiry
- Decrypting JWE-encrypted tokens or payloads exchanged between services that require confidentiality, not just integrity
- Validating and parsing JWKS (JSON Web Key Sets) to support key rotation for federated identity providers
Under The Hood
Architecture: The library is organized around the four JOSE primitives as top-level modules (jose/jws.py, jose/jwe.py, jose/jwk.py, jose/jwt.py), with jose/backends/ providing a strategy-pattern abstraction (base.py defines the interface; cryptography_backend.py, rsa_backend.py, ecdsa_backend.py, and native.py implement it) so the same signing/verification calls dispatch to whichever cryptographic library is installed, auto-detected at import time. jose/constants.py centralizes algorithm identifiers and jose/utils.py handles base64url encoding conventions used throughout JOSE. Tech Stack: Pure Python 3.9+, with ecdsa, rsa, and pyasn1 as always-installed native-backend dependencies, plus optional extras for cryptography or pycryptodome to swap in a faster/more standard backend; packaging uses setuptools with setup.cfg-driven metadata and a pyproject.toml build-backend declaration. Code Quality: The tests/ directory contains 21 test files covering each backend and JOSE primitive separately (e.g. backend-specific signature tests, cross-backend JWK conformance), with pytest-cov wired into CI (.codecov.yml) to track coverage; the multi-backend design forces test parity across three implementations, which is a meaningful correctness safeguard for a cryptography library. API Design: The jwt.encode()/jwt.decode() functions mirror the ergonomics of the popular PyJWT library closely, requiring only a payload dict, key, and algorithm string to get started, while the lower-level jws/jwe modules are available for applications needing direct control over JOSE primitives beyond the JWT convenience wrapper.
Used by 6 apps in this directory
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
Flowfile
Data Engineering
Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.
Flowsint
Automation · Developer Tools
A privacy-first, graph-based OSINT investigation platform with 30+ automated enrichers for mapping relationships between domains, IPs, people, and organizations.
Glass by Pickle
AI Assistants
A privacy-first desktop AI assistant that sees your screen, hears your meetings, and turns live context into structured summaries—without sending a single byte to the cloud.
Glean
Knowledge Management · Bookmarks Archiving
Self-hosted RSS reader and personal knowledge management tool with MCP server integration for AI assistant connectivity.
Open WebUI
AI Assistants · AI Agents
The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.