PyJWT
HS256 is unaffected and ES384 or RSA-3072+ work as stopgaps, but there is no ML-DSA until PR #1256 merges; enforce RSA key size yourself.
- PyPI
PyJWT- Version cited
- 2.15.128 Sep 2026
- Downloads
- 763M/mo
Key exchange and encryption
Not affected
No JWE or key exchange
Signatures and identity
Stopgap only
Stopgap only; ML-DSA PR #1256 open
What to do
Keep HS256 for single-service tokens. Otherwise use ES384 or PS256/RS256 with RSA-3072+ (assert key size), pin algorithms= per issuer, test JWKS with a synthetic AKP key, and track PR #1256.
Since 1 Dec 2026 Community comments on ML-DSA PR #1256 on 3 Dec 2026 (AGY: PR updated 3 Dec); Apache Airflow #78000 (3 Dec) is blocked on it; no maintainer comment.
Details
PyJWT is the most-downloaded JWT library covered here, with 763,231,466 downloads in 30 days. It is the JWT engine of fastapi-users and django-allauth’s OIDC client, and FastAPI’s official tutorial uses it with HS256.
What it supports today#
- No default algorithm; the caller chooses. It supports ES256, ES256K and EdDSA, plus ES384, ES512 and RS/PS256–512 (PyPI PyJWT 2.15.1).
- The RSA floor only warns.
_MIN_KEY_SIZE = 2048; below it PyJWT emitsInsecureKeyLengthWarningunlessenforce_minimum_key_lengthis set, and there is no 3072 floor. Assertkey.key_size >= 3072yourself (recipe). cryptographyis optional, via thecryptoextra, declared as>=3.4.0, so environments can resolve to versions without ML-DSA. Pincryptography>=48yourself if you plan to use PR #1256.- No ML-DSA. PyJWT 2.15.1’s algorithms.py registers no RFC 9964 algorithm; in the ASTRA test environment with
cryptography51.0.0 its default registry contained none. - JWKS caching.
PyJWKClient(..., cache_jwk_set=True)inPyJWT >= 2.15.0caches parsedPyJWKSetobjects (AGY report), which matters once ML-DSA JWKS documents grow to about 15–20 KB.
ML-DSA: PR #1256#
PR #1256, opened 20 Nov 2026, adds ML-DSA-44/65/87 and AKP JWKs and needs cryptography ≥48. It is open and unmerged. Community comments arrived on 3 Dec 2026, with no maintainer comment. Apache Airflow #78000, opened 3 Dec, asks for ML-DSA JWT signing and is blocked on it.
Sources disagree. The AGY report calls ML-DSA support “imminent” (PR updated 3 Dec 2026; “watch 2.16.0”). The OpenID Foundation’s October 2026 table lists PyJWT as “No Plans Yet”, and a DEV write-up lists it as not yet released. An Auth0 Community post claims PyJWT “has begun incorporating” ML-DSA; the Claude report treats this as false until a release.
Until it ships, options are jwcrypto, a pinned build of PR #1256, or a custom signer calling pyca/cryptography ≥48 mldsa directly.
Before switching, budget for size: an ML-DSA-65 token adds 4,326 B to every request ASTRA, and columns that store tokens or keys need widening (wire cost, storage).
Unknown kty in JWKS#
Sources disagree. The AGY report says
PyJWKSetskips unknownktyvalues such asAKP, so mixed JWKS are safe. The Claude report did not verify whether PyJWT 2.15.1’sPyJWKClient/PyJWKSetskips or raises, and recommends testing with a syntheticAKPentry. A verifier that fails the whole JWKS breaks login when IdPs publish ML-DSA keys (AKP tolerance).
The zero-downtime verifier recipe for rotating IdPs is on the FastAPI page.
Full discussion: FastAPI and auth
Sources cited on this page 7
- PyPI PyJWT 2.15.1 pypi.org
- PyJWT 2.15.1’s algorithms.py github.com
- PR #1256 github.com
- Apache Airflow #78000 github.com
- OpenID Foundation openid.net
- DEV write-up dev.to
- Auth0 Community post community.auth0.com