When to Use OAuth vs API Keys
| API Keys | OAuth 2.0 | |
|---|---|---|
| Use case | Direct API access, scripts, CI/CD | Third-party integrations (Copilot, ChatGPT, Claude) |
| Who creates credentials | You, in the Bedrock dashboard | Automated via dynamic registration or pre-configured |
| Token lifetime | Long-lived (with optional rotation) | Short-lived access (1 hour) + refresh token |
| Authentication | Authorization: Bearer sk_... | Authorization: Bearer oat_... |
Discovery (MCP Auth Spec)
AI copilots discover Bedrock’s OAuth configuration automatically using well-known metadata endpoints.Protected Resource Metadata
Authorization Server Metadata
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 theclient_id.
Dynamic Client Registration (RFC 7591)
Clients like Claude self-register by POSTing to/oauth/register:
Client ID Metadata Documents (CMID)
Clients like ChatGPT use a URL as theirclient_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:Step 2: Token Exchange
Step 3: Use the Access Token
Step 4: Refresh
Step 5: Revoke
Scopes
| Scope | Permissions |
|---|---|
read | Read projects, drawings, sheets, blocks, features, overlays, jobs, organizations |
write | Create/update projects, drawings, files, jobs |
Platform Compatibility
| ChatGPT | Claude.ai / Cowork | Claude Code | Microsoft Copilot | |
|---|---|---|---|---|
| Registration | CMID preferred, DCR fallback | DCR | DCR or pre-configured | Pre-registered (static) |
| PKCE | Required (S256) | Required (S256) | Required (S256) | Optional |
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)