OAuth authorization server metadata: safely discover trusted endpoints and capabilities
Learn what RFC 8414 metadata contains, how to construct its well-known URL, and why a trusted issuer and exact issuer matching must come before using discovered endpoints.
OAuth authorization server metadata: safely discover trusted endpoints and capabilities
OAuth Authorization Server Metadata (RFC 8414) is a JSON document that lets a client discover endpoint URLs and supported capabilities for an authorization server based on its issuer. It can include the authorization and token endpoints, supported response types, PKCE methods, and token-endpoint authentication methods. A public metadata document does not by itself make the server trustworthy, so the client must first choose an issuer from a trusted configuration or registration record.
What problem does metadata solve?
An OAuth client needs to know where to send the user for authorization and where to exchange a code for tokens. Copying provider-specific URLs into code can lead to connections to the wrong endpoint when an environment changes, or to implementations that assume unsupported security features. RFC 8414 metadata provides a standard way to look up endpoint locations and server capabilities.
The issuer field is required. Fields such as authorization_endpoint, token_endpoint, jwks_uri, revocation_endpoint, introspection_endpoint, and code_challenge_methods_supported are published according to what the server supports. The meaning of an absent field depends on its definition: it may mean a capability is unavailable, or that support needs to be checked another way. Check each field's RFC definition and the provider's documentation.
Finding the metadata URL
The client first obtains an issuer it trusts, then constructs the metadata URL using RFC 8414's well-known URI rules and requests the document with HTTPS GET. For the issuer https://auth.example, the standard oauth-authorization-server suffix gives this example:
issuer: https://auth.example
metadata: https://auth.example/.well-known/oauth-authorization-serverIf the issuer contains a path, apply the rule that includes the path. For example, https://auth.example/tenant-a maps to https://auth.example/.well-known/oauth-authorization-server/tenant-a. These examples use the generic OAuth metadata suffix from RFC 8414. OpenID Connect Discovery generally uses /.well-known/openid-configuration; follow each specification and provider documentation for the exact path rules. Do not mix the two URLs arbitrarily.
Validate the response before trusting it
**Check the issuer's source:** Do not take an issuer without validation from arbitrary user input, search ads, or email links. Select it from configuration the service trusts.
**Validate HTTPS:** Confirm that the connected server's TLS certificate is valid for the issuer host. Do not ignore certificate errors to retrieve metadata.
**Match the issuer:** The response's `issuer` must exactly match the issuer used to fetch metadata. If it does not match, do not use the document's endpoints.
**Check endpoints and capabilities:** Confirm that `authorization_endpoint`, `token_endpoint`, and needed capabilities are present and use the expected HTTPS origin. Check that the published token-endpoint authentication methods and PKCE methods match what the client expects.
**Apply policy separately:** A listed scope or response type does not automatically determine what a user may authorize. Check client registration, user consent, least-privilege scopes, and application policy separately.
These checks reduce mix-up and man-in-the-middle risks. If a client accepts metadata with a different issuer and switches to its endpoints, it could send an authorization code or token to an attacker's server.
How far should you rely on metadata?
| Metadata field | What it helps you check | Caution |
|---|---|---|
issuer | Binds the metadata to the server identity | Obtain the trusted issuer from a separate, secure source |
authorization_endpoint / token_endpoint | Destinations for authorization requests and code exchange | Verify HTTPS and issuer matching; do not replace them with arbitrary endpoints |
code_challenge_methods_supported | PKCE methods supported by the server | If it is not published, do not assume support; check official documentation |
token_endpoint_auth_methods_supported | Client authentication methods the server advertises | Choose for the client type; never embed a client secret in a public app |
jwks_uri | Location of public keys for verifying signed tokens | Apply the token's signature and issuer validation rules when using keys |
Metadata is public information, but its security depends on retrieving it from the correct issuer. Define caching and refresh behavior for endpoint or capability changes, and avoid automatically connecting to a new token endpoint based on unverified metadata or stale configuration.
Summary
OAuth authorization server metadata is a standard JSON way to discover endpoints and capabilities for an issuer you already trust. Choose the issuer from a trusted source, then verify the TLS certificate and exact issuer match before using any endpoint. Metadata helps configure a client; it does not replace trust policy or user authorization decisions.
References
[RFC 8414 — OAuth 2.0 Authorization Server Metadata](https://www.rfc-editor.org/rfc/rfc8414.html)
[RFC 9700 §2.6 — Other Recommendations](https://www.rfc-editor.org/rfc/rfc9700.html#section-2.6)
[OpenID Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html)