Discovering a provider from its issuer
- Issuer URL → Fetch metadata
- Fetch metadata → Issuer matches?
- Issuer matches? → Use endpoints, keysmatches
- Issuer matches? → Refuse itdiffers
- Use endpoints, keys → Cache, refresh
Start from the issuer URL and fetch the metadata at its well-known openid-configuration path. Check that the issuer in the response exactly equals the URL you started from. If it differs, refuse the document. If it matches, use the authorization and token endpoints and the jwks_uri keys it lists, then cache the document and refresh it periodically.
Wiring an application to an identity provider used to mean copying half a dozen URLs, an algorithm list, and a signing key into configuration, then updating them whenever the provider changed. OpenID Connect Discovery 1.0 replaces that with one value: the issuer URL. From it, any compliant client can fetch a JSON document that tells it everything else it needs.
How OIDC discovery works
- Start from the issuer, for example
https://id.example.com. - Fetch the metadata at the issuer plus
/.well-known/openid-configuration:
curl https://id.example.com/.well-known/openid-configuration
- Validate the issuer. The
issuervalue in the response must exactly equal the URL you started from. - Use the endpoints and keys it lists: send users to
authorization_endpoint, redeem codes attoken_endpoint, verify ID tokens with keys fromjwks_uri. - Cache the document and refresh it periodically.
A trimmed response:
{
"issuer": "https://id.example.com",
"authorization_endpoint": "https://id.example.com/authorize",
"token_endpoint": "https://id.example.com/token",
"userinfo_endpoint": "https://id.example.com/userinfo",
"jwks_uri": "https://id.example.com/jwks",
"response_types_supported": ["code"],
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256"],
"code_challenge_methods_supported": ["S256"],
"scopes_supported": ["openid", "profile", "email"]
}
Required and useful fields
| Field | Status in OIDC Discovery 1.0 | What the client does with it |
|---|---|---|
issuer |
Required | Compares with the discovery URL and the iss of every ID token |
authorization_endpoint |
Required | Redirects the browser here to sign in |
token_endpoint |
Required unless only the implicit flow is used | Exchanges the code for tokens |
jwks_uri |
Required | Fetches the JWKS to verify signatures |
response_types_supported |
Required | Picks a supported flow, usually code |
subject_types_supported |
Required | Learns whether sub is public or pairwise |
id_token_signing_alg_values_supported |
Required | Knows which algorithms to accept |
userinfo_endpoint |
Recommended | Fetches profile claims |
code_challenge_methods_supported |
Defined by RFC 8414 | Confirms PKCE S256 support |
OIDC discovery and RFC 8414
RFC 8414, OAuth 2.0 Authorization Server Metadata, generalises the same idea
to plain OAuth servers at /.well-known/oauth-authorization-server. For
issuers with a path, RFC 8414 inserts the well-known segment between the host
and the path, while OIDC discovery appends it after the path. Clients that
support both should try the one their provider documents.
When discovery matters
- Multi-tenant providers, where each tenant is its own issuer and hard-coded URLs would multiply.
- Key rotation, because
jwks_urilets clients pick up new keys without a configuration change. - Standard libraries. Most OpenID Connect client libraries take only an issuer, a client ID, and a redirect URI, and discover the rest.
- Security reviews, since the document states which flows and algorithms the provider allows.
Pitfalls
- Skipping the issuer check. Accepting a document whose
issuerdiffers from the URL you fetched opens the door to mix-up attacks. - Discovery over plain HTTP. The metadata decides where credentials go; fetch it only over TLS.
- Trusting user input for the issuer. Letting a request choose the issuer URL lets an attacker point your client at their own provider.
- Never refreshing. Endpoints and keys change. Cache with an expiry. A stale key set is the usual cause of a “kid not found” verification error.
- Accepting every advertised algorithm. Configure the algorithms you
accept yourself, and never accept
none. - Confusing tenants. In multi-tenant setups, verify the token’s
issagainst the tenant you expected, not just any tenant of the provider.
How QuorumAuth handles OIDC discovery
In QuorumAuth, each organization is its own OpenID Provider. In its tested behaviour:
- Stable issuer. An organization’s issuer is the public address followed
by
/oidc/and the organization’s immutable ID, so renaming the organization never changes it. - Standard discovery. A standard OpenID relying party library discovers the organization with no QuorumAuth-specific knowledge. The provider offers the authorization code flow with S256 PKCE and nothing else, signs ID tokens with RS256 alone, and advertises its authorize, token, and userinfo endpoints under the issuer.
- Exact key set. The advertised
jwks_uriholds exactly the keys the organization publishes. - No phantom issuers. Discovery for an organization that does not exist is refused as not found, and so is the key set path under it.
- Declared clients only. Organizations declare the relying parties their provider signs in, with exact redirect URIs and whether the client is public and uses PKCE. No organization can declare, read, or remove another’s relying parties, and a redirect URI matches only exactly as registered.
Frequently asked questions
Where is the OIDC discovery document?
At the issuer URL followed by /.well-known/openid-configuration. If the issuer has a path, the suffix is appended after that path.
What is the difference between OIDC discovery and RFC 8414?
RFC 8414 defines OAuth 2.0 authorization server metadata at /.well-known/oauth-authorization-server. OIDC discovery predates it and adds OpenID-specific fields. Many servers publish both.
Do I need to hard-code any endpoint?
Only the issuer. Everything else, including the token endpoint and jwks_uri, comes from the discovery document.
Why must the issuer match exactly?
The issuer in the document must equal the URL you discovered from and the iss claim in ID tokens. Otherwise a malicious document could redirect you to someone else's endpoints.