Authorization Server and Resource Server metadata (RFC 8414 + the OAuth-Protected-Response draft used by ATProto).
ATProto authorization servers publish their capabilities at
/.well-known/oauth-authorization-server, and PDSs (as resource servers)
publish their authorization server at
/.well-known/oauth-protected-resource. Both documents are validated
strictly against the ATProto OAuth profile before use: the issuer must
match the origin the document was fetched from, and the declared features
(PAR, PKCE, DPoP/ES256, private_key_jwt, the atproto scope, the
authorization-response iss parameter) must all be supported.
Summary
Functions
Fetch and validate the Authorization Server metadata document for a server origin.
Fetch a PDS's Resource Server metadata
(/.well-known/oauth-protected-resource) and return the authorization
server origin it declares.
Rebuild metadata serialized with to_map/1.
The scopes to request: the intersection of the client's desired scopes with those the server supports.
The metadata as a plain, Jason-encodable map for persistence. The raw
document is dropped — the validated fields are what clients rely on.
Validate a parsed Authorization Server metadata document against the ATProto OAuth profile requirements.
Types
Functions
Fetch and validate the Authorization Server metadata document for a server origin.
origin is the server's scheme://host[:port] root (e.g.
"https://bsky.social"). The document's issuer must equal this origin.
Fetch a PDS's Resource Server metadata
(/.well-known/oauth-protected-resource) and return the authorization
server origin it declares.
Per the spec the list must contain exactly one origin URL. Returns
{:error, :protected_resource_metadata_not_found} when the PDS hosts its
own authorization server (HTTP 404).
Rebuild metadata serialized with to_map/1.
The scopes to request: the intersection of the client's desired scopes with those the server supports.
The metadata as a plain, Jason-encodable map for persistence. The raw
document is dropped — the validated fields are what clients rely on.
Validate a parsed Authorization Server metadata document against the ATProto OAuth profile requirements.