Skip to main content
Bedrock supports OAuth 2.1 authorization code flow with PKCE for third-party integrations like Microsoft 365 Copilot, ChatGPT, and Claude. OAuth lets external AI agents authenticate to the Bedrock API on behalf of an organization.

When to Use OAuth vs API Keys

Discovery (MCP Auth Spec)

AI copilots discover Bedrock’s OAuth configuration automatically using well-known metadata endpoints.

Protected Resource Metadata

Returns:

Authorization Server Metadata

Returns:

WWW-Authenticate Header

Unauthenticated requests to protected endpoints return:

Client Registration

Bedrock supports three methods for registering OAuth clients:

Static Clients

Pre-registered for known partners (e.g., Microsoft Copilot). These are seeded in the database with a fixed slug as the client_id.

Dynamic Client Registration (RFC 7591)

Clients like Claude self-register by POSTing to /oauth/register:
Response:

Client ID Metadata Documents (CMID)

Clients like ChatGPT use a URL as their client_id. When Bedrock encounters a URL-based client_id, it fetches the metadata document to validate the client and its redirect URIs.

Authorization Code Flow with PKCE

Step 1: Authorization

The copilot redirects the user to the consent screen:
The user logs in (if needed), sees the client name and requested permissions, selects an organization, and clicks Authorize or Deny. On approval, the consent screen signs a PKCE-bound authorization code and redirects directly to the client’s callback:

Step 2: Token Exchange

Response:

Step 3: Use the Access Token

Step 4: Refresh

Returns a new access/refresh token pair. The old refresh token is revoked.

Step 5: Revoke

Always returns 200 OK, even if the token was already revoked or not found (per RFC 7009).

Scopes

Platform Compatibility

Security

  • All tokens are stored as SHA-256 hashes (never in plaintext)
  • Access tokens expire after 1 hour
  • Refresh tokens expire after 30 days
  • PKCE (S256) is required for all authorization requests
  • Authorization codes expire after 10 minutes
  • Tokens are scoped to a specific organization (selected during consent)