API / Auth / MCP
OAuth Discovery
Automatic discovery of OAuth 2.0 endpoints via /.well-known/oauth-authorization-server (RFC 8414).
What is OAuth Discovery?
OAuth Discovery is a mechanism for automatically discovering an OAuth 2.0 Authorization Server via a JSON document at /.well-known/oauth-authorization-server (RFC 8414) or /.well-known/openid-configuration (OIDC). It contains all the endpoints an agent needs to initiate an OAuth flow without any manual configuration.
{
"issuer": "https://example.com",
"authorization_endpoint": "https://example.com/oauth/authorize",
"token_endpoint": "https://example.com/oauth/token",
"jwks_uri": "https://example.com/.well-known/jwks.json",
"scopes_supported": ["read", "write"],
"response_types_supported": ["code"]
}
Why do you need OAuth Discovery?
AI agents that need authorized API access must locate the OAuth Authorization Server. Without discovery, the agent requires explicit user configuration — which blocks autonomous operation.
With OAuth Discovery, an agent:
- Receives the service domain
- Requests
/.well-known/oauth-authorization-server(or/.well-known/openid-configuration) - Reads
authorization_endpointandtoken_endpoint - Initiates the OAuth flow without human involvement
This is especially important for MCP servers: the MCP specification requires OAuth Discovery for authorized servers.
How do you implement OAuth Discovery?
Most OAuth providers publish discovery automatically:
| Provider | URL |
|---|---|
| Auth0 | https://<tenant>.auth0.com/.well-known/openid-configuration |
| Keycloak | https://<host>/realms/<realm>/.well-known/openid-configuration |
| Okta | https://<tenant>.okta.com/.well-known/oauth-authorization-server |
If you are running your own OAuth server, publish the JSON at /.well-known/oauth-authorization-server. Required fields per RFC 8414:
issuer— base URL of your serverauthorization_endpoint— URL for authorizationtoken_endpoint— URL for obtaining a tokenjwks_uri— URL with public keys
For protected resources, also publish OAuth Protected Resource Metadata (RFC 9728), which points back to the Authorization Server.
How do we check OAuth Discovery?
The scanner checks two paths in order of priority:
/.well-known/openid-configuration/.well-known/oauth-authorization-server
For each path:
- HTTP 200 — document is accessible
- Valid JSON — body parses without errors
- Required fields —
issuer,authorization_endpoint,token_endpoint,jwks_uriare present
pass — at least one path returned HTTP 200 with valid JSON and all four fields. fail — neither path responds or required fields are missing.