Agent Wranglers

WEB-173Optional

Publish your sign-in server settings

If you run an OAuth or OpenID sign-in server, publish its settings at /.well-known/oauth-authorization-server or /.well-known/openid-configuration. If an API needs OAuth, publish /.well-known/oauth-protected-resource.

How to do it

Serve the server's details as JSON, in the format RFC 8414 or OpenID Connect Discovery 1.0 sets out. The issuer must equal the URL the file is fetched from, minus the well-known part. If the issuer has a path, such as https://example.com/tenant1, insert the well-known name before it, as in /.well-known/oauth-authorization-server/tenant1. List code_challenge_methods_supported with S256, because clients such as MCP clients refuse servers without PKCE. For an API, serve RFC 9728 JSON whose resource equals the API's URL. Answer a request without a valid token with 401 and a WWW-Authenticate header that points to it. An MCP server must do this, as Publish protected resource metadata for every MCP server that needs sign-in says. Issue tokens with narrow scopes, as Grant narrow scopes says.

Examples

JSON example

{
  "issuer": "https://example.com",
  "authorization_endpoint": "https://example.com/oauth/authorize",
  "token_endpoint": "https://example.com/oauth/token",
  "response_types_supported": ["code"],
  "code_challenge_methods_supported": ["S256"]
}

JSON example 2

{
  "resource": "https://api.example.com",
  "authorization_servers": ["https://example.com"],
  "scopes_supported": ["read", "write"]
}

HTTP example

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://api.example.com/.well-known/oauth-protected-resource"

How to check

Fetch each published file. Its issuer or resource equals the URL exactly, and every endpoint it lists answers. An OIDC client library finds the provider from the issuer URL. An unauthenticated API request returns 401 with resource_metadata in WWW-Authenticate.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/standard-addresses/oauth-authorization-server">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.