OAuth for AI Clients
The authorization server that lets MCP clients connect with one click instead of a pasted API key.
Flow (authorization code + PKCE)
- POST /api/oauth/register with the client's redirect URIs (RFC 7591 dynamic registration).
- GET /oauth/authorize?response_type=code&client_id=...&redirect_uri=...&scope=...&code_challenge=...&state=...
- The signed-in user picks a workspace and approves on the consent screen.
- The browser is redirected back with ?code=...&state=...
- POST /api/oauth/token with grant_type=authorization_code, code, code_verifier, redirect_uri.
- Call /api/mcp with Authorization: Bearer <access_token>.
Rules the server enforces
- PKCE S256 is mandatory; the plain method is rejected.
- Redirect URIs must match exactly — https, or http only on loopback (desktop clients).
- Authorization codes are single-use and expire in 60 seconds.
- Requested scopes are narrowed to what the client registered and what Komenin supports.
- Access tokens live 1 hour; refresh tokens 30 days and rotate on every refresh.
Token request
curl -X POST https://your-app/api/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "client_id=komenin_..." \
-d "code=<authorization code>" \
-d "redirect_uri=https://claude.ai/api/mcp/auth_callback" \
-d "code_verifier=<pkce verifier>"
# → { "access_token": "koat_...", "token_type": "Bearer",
# "expires_in": 3600, "refresh_token": "kort_...", "scope": "accounts:read ..." }Revoking access
POST /api/oauth/revoke with the token (and optionally client_id). Revoking either the access or the refresh token kills the whole rotation chain. Suspending the granting user or workspace also ends every token immediately.
Need the product UI? Open command center