What an OpenID discovery document is
An OpenID provider publishes a JSON document that describes itself. It lists the URLs of its endpoints, the flows it supports, the signing algorithms it uses and the claims it can return. Clients read it once and configure themselves from it, instead of hard-coding every URL.
The format comes from OpenID Connect Discovery 1.0. OAuth 2.0 later got the same idea for plain authorization servers in RFC 8414, which uses the path /.well-known/oauth-authorization-server. Most OpenID providers, Keycloak included, serve the OpenID version at /.well-known/openid-configuration under the issuer.
The document is public. It holds no secrets, only facts about the server. That makes it the fastest way to answer questions such as “which token endpoint do I call?” or “does this server support PKCE with S256?”.
Why discovery exists
Before discovery, every client library needed a hand-written list of endpoints for every provider. A typo in one URL broke sign-in, and a provider could not move an endpoint without breaking clients.
With discovery, a client needs only one value: the issuer. It appends /.well-known/openid-configuration, fetches the JSON, and reads everything else from it. Libraries for most languages accept an issuer or discovery URL and do this for you.
The issuer is also the value that ID tokens and access tokens carry in their iss claim. So the discovery document ties together where the client sends requests and what it must check in the tokens it gets back.
What the document contains
OpenID Connect Discovery 1.0 marks some fields as required. A valid document has issuer, authorization_endpoint, jwks_uri, response_types_supported, subject_types_supported and id_token_signing_alg_values_supported. It also needs token_endpoint unless the provider supports only the implicit flow.
Everything else is optional, and providers add their own fields. Here is a shortened, made-up sample in the shape Keycloak serves for a realm named acme. It is not from a real server.
{
"issuer": "https://auth.example.com/realms/acme",
"authorization_endpoint": "https://auth.example.com/realms/acme/protocol/openid-connect/auth",
"token_endpoint": "https://auth.example.com/realms/acme/protocol/openid-connect/token",
"jwks_uri": "https://auth.example.com/realms/acme/protocol/openid-connect/certs",
"response_types_supported": ["code", "none", "id_token", "token"],
"subject_types_supported": ["public", "pairwise"],
"id_token_signing_alg_values_supported": ["RS256", "ES256"],
"code_challenge_methods_supported": ["plain", "S256"]
}Endpoints
| Field | What it is for |
|---|---|
authorization_endpoint | Where the browser is sent to sign in. |
token_endpoint | Where the client exchanges a code or credentials for tokens. |
userinfo_endpoint | Returns claims about the signed-in user. |
jwks_uri | The public keys used to verify token signatures. |
end_session_endpoint | Where the browser is sent to log out. |
introspection_endpoint | Tells an API whether a token is active (RFC 7662). |
revocation_endpoint | Revokes a token (RFC 7009). |
device_authorization_endpoint | Starts the device flow (RFC 8628). |
pushed_authorization_request_endpoint | Accepts pushed authorization requests (RFC 9126). |
Capability lists
The fields ending in _supported are lists. grant_types_supported says which grants the server knows. code_challenge_methods_supported says whether it accepts PKCE and with which methods. token_endpoint_auth_methods_supported lists the ways a client may authenticate, such as client_secret_basic or private_key_jwt. scopes_supported and claims_supported list what a client may ask for.
A value in a list means the server can do it, not that every client may. In Keycloak, a flow listed in the document still has to be switched on for each client.
What this tool does
The viewer reads a discovery document and lays it out so you can scan it. It shows every URL field, every list as a row of badges, and every true or false flag. Fields it does not know are shown too, so provider-specific additions are not hidden.
It also runs a few checks:
- Required fields: it names any field that OpenID Connect Discovery requires and the document lacks.
- Issuer scheme: it warns when the issuer does not use https.
- Issuer match: after a fetch, it checks that the URL you fetched equals the issuer plus
/.well-known/openid-configuration. - PKCE: it says whether
S256appears incode_challenge_methods_supported. - Keycloak layout: when the issuer ends in
/realms/<name>, it shows the realm name.
What it does not do
It does not fetch the keys at jwks_uri, call any endpoint, or test that the server really behaves as the document claims. It reads the JSON you give it. Everything runs in your browser, and nothing you paste is sent to us.
How to use the viewer
- Find the discovery URL. For Keycloak it is
https://<host>/realms/<realm>/.well-known/openid-configuration. - Type it into the Discovery URL field and press Fetch.
- If the fetch fails, press Open in a new tab, copy the JSON from the page and paste it into the box.
- Read the checks at the top of the result, then the endpoints and the lists.
- Copy the endpoint URLs you need into your client configuration or into our request builders.
Fetch, CORS and why paste always works
Fetch asks your browser to read the URL directly. The request goes from your browser to the server; it does not pass through us, and we run no proxy.
Browsers block a page from reading a response from another site unless that site sends CORS headers that allow it. Whether a discovery endpoint sends them depends on the server and on any proxy in front of it. If it does not, the fetch fails with a network error even though the URL opens fine in a tab.
Opening the URL in a tab is a normal visit, not a cross-origin read, so it always shows the JSON. Copy it and paste it into the viewer. The result is the same.
Where you need discovery
Single-page apps
Browser libraries usually take the issuer and fetch discovery at startup. That fetch is cross-origin, so the server must allow it, just as for the viewer. Later calls from the browser to the token endpoint are cross-origin too. In Keycloak, the client’s Web origins setting decides which origins may make those calls.
Back ends and APIs
A web back end reads the authorization and token endpoints. An API that validates JWT access tokens reads issuer and jwks_uri, so it knows which iss to accept and where to get the signing keys. Cache the document; it rarely changes.
Mobile, desktop and device apps
Native apps read the same endpoints. Devices that use the device flow need device_authorization_endpoint, which is only present when the server supports RFC 8628.
Debugging a new provider
When you connect to a provider for the first time, its discovery document answers most setup questions in one page: which grants, which client authentication methods, which algorithms.
How Keycloak serves discovery
Each Keycloak realm is its own issuer with its own discovery document at https://<host>/realms/<realm>/.well-known/openid-configuration. Keycloak 17 and later serve this without the /auth prefix that older versions used. A server set up with a relative path serves it under that path.
Keycloak builds the issuer and endpoint URLs from its configured hostname or, if none is set, from the request it received. Behind a reverse proxy this matters. Set the hostname and the forwarded headers so the URLs match the address users and clients see.
All Keycloak endpoints follow the same layout under the realm: /protocol/openid-connect/auth, /token, /userinfo, /logout, /certs, /token/introspect, /revoke, /auth/device and /ext/par/request.
Common problems and fixes
The issuer does not match
Tokens carry the issuer in iss, and clients reject tokens whose issuer differs from the one they expect. A common cause is a proxy: the server sees an internal address and builds an issuer such as http://keycloak:8080/realms/acme. Fix the hostname and proxy settings, then fetch the document again.
http instead of https
An issuer with http:// behind a TLS-terminating proxy usually means the server does not know the original request was https. Configure it to trust the forwarded protocol header from your proxy.
A 404 on the discovery URL
Check the realm name, which is case-sensitive, and whether your server uses a path such as /auth. The realm must exist and be enabled.
S256 is missing
If code_challenge_methods_supported is absent or lacks S256, the server does not advertise PKCE with SHA-256. Keycloak lists it. For another provider, check its documentation before you rely on PKCE.
Security notes
Fetch discovery over https only, and only from the issuer you trust. A client that takes its endpoints from a forged document will send users and codes to the wrong place.
Pin the issuer in your configuration and check that the document’s issuer equals it. OpenID Connect Discovery requires this match.
RFC 9700, the OAuth security best current practice, recommends PKCE for all clients and advises against the implicit flow. A server may still list token and id_token token in response_types_supported. That only means it can do them; use code with PKCE.
Best practices
- Configure clients with the issuer, not with individual endpoint URLs.
- Cache the document and the keys, and refresh the keys when a token arrives with an unknown
kid. - Check
issueragainst your pinned value on every load. - Prefer
codewithS256even when the server lists other response types. - Read
token_endpoint_auth_methods_supportedand pick the strongest method your client can use.