Skip to main content
Gumnut implements OAuth 2.1 for secure, user-facing authentication. OAuth is ideal for web applications, mobile apps, and third-party integrations that need to access Gumnut resources on behalf of a user.

How OAuth Works

  1. Authorization Request: Your app redirects users to Gumnut’s authorization page
  2. User Consent: Users approve the requested permissions (scopes)
  3. Authorization Code: Gumnut redirects back with an authorization code
  4. Token Exchange: Your app exchanges the code for access tokens
  5. API Access: Use the access token to make authorized requests

OAuth Endpoints

  • Authorization: https://api.gumnut.ai/oauth/authorize
  • Token: https://api.gumnut.ai/oauth/token
  • Token Revocation: https://api.gumnut.ai/oauth/revoke

OAuth Metadata

Protected Resource Metadata is available at:
  • /.well-known/oauth-protected-resource/mcp (RFC 9728)
This endpoint points MCP clients to the authorization server for OAuth flows.

Authorization Code Flow with PKCE

PKCE (Proof Key for Code Exchange) is the recommended flow for all clients:
Confidential server-side applications may also include client_secret in the token exchange request.

Scopes

Control access with granular scopes:

Using OAuth Tokens

Once obtained, use OAuth tokens as Bearer tokens:

Token Lifecycle

Refreshing Tokens

Integration Examples

Python with OAuth

React

Troubleshooting

OAuth Redirect Issues

  • Verify redirect URI matches exactly (including trailing slashes)
  • Ensure redirect URI is whitelisted in your OAuth app settings
  • Check for URL encoding issues

Token Expiration

  • Implement token refresh logic
  • Monitor token expiry times
  • Handle 401 responses gracefully with retry logic

CORS Issues (Browser)

  • OAuth tokens work in browsers with proper CORS headers
  • API keys should not be used in client-side code
  • Use a backend proxy for API key authentication

WWW-Authenticate Headers

Failed authentication returns proper WWW-Authenticate headers per the OAuth spec: