Expand description
OAuth 2.1 client authentication at the token endpoint.
Currently supports:
none— public client; PKCE substitutes for client authprivate_key_jwt— RFC 7521 / RFC 7523 §2.2 client assertion
The client assertion is a JWT signed by one of the keys in the
registered client’s jwks field (inline) or via jwks_uri
(deferred). Claim requirements per RFC 7523 §3 + the atproto OAuth
profile (#1146 T1.2/T3.3):
iss == sub == client_id
aud == the AS issuer. The atproto OAuth profile mandates this form;
RFC 7523 §3 permits the token endpoint URL too, but this AS
accepts the issuer ALONE at every endpoint (PAR and token) —
see #1146 T1.2.
exp > now
iat present and not in the future (beyond 60s clock skew)
jti present and unique per client until exp (replay registry in
OAuthState::assertion_jti_seen)
alg per the JWKS key kty/crv (RS256, ES256, EdDSA)
Spec reference: MCP 2025-11-25 § Client ID Metadata Documents lists
private_key_jwt as a MAY for clients (CIMD §6.2). Servers honoring
the token_endpoint_auth_method field in a CIMD/DCR registration
MUST validate the assertion before issuing tokens.
Structs§
- Verified
Assertion - A successfully verified client assertion.
Enums§
- Client
Auth Error - Client authentication failure.
Constants§
Functions§
- requires_
private_ key_ jwt - Decide whether a registered client requires
private_key_jwt. Default is “no” — i.e. public client / PKCE-only — unless the registration explicitly settoken_endpoint_auth_method=private_key_jwt. - verify_
assertion_ with_ keys - Pure-sync core verification: given a set of candidate keys, verify the JWT’s signature and claims. Used both by the async public entry point and directly by unit tests.
- verify_
client_ assertion - Verify an RFC 7523 client_assertion against the registered client’s
JWKS — inline
jwksif present, otherwise fetched fromjwks_uri(cached forstate.client_jwks_uri_cache_ttl).expected_audiencesis the acceptedaudset — on every profile path this is the AS issuer alone (atproto mandate, #1146 T1.2).