Skip to main content
FrontMCP includes a built-in OAuth 2.1 authorization server for self-contained authentication scenarios.
The built-in login page accepts any email format without validation. Replace with a real identity provider for production use.

Basic Configuration

Configuration Options


OAuth Endpoints

Local mode exposes standard OAuth 2.1 endpoints:

Authorization Request

Token Exchange

OAuth Callback Flow (/oauth/callback)

The callback endpoint processes the user’s response from the authorization page and creates an authorization code. It executes through the following stages:

Callback Query Parameters

Federated Provider Chaining

When federated=true and providers are selected:
  1. A federated session is created to track progress
  2. PKCE is generated for the first provider
  3. User is redirected to the first provider’s authorization URL
  4. After each provider completes, the chain continues to the next
  5. Once all providers complete, an authorization code is created
Selected provider IDs are validated against the pending authorization’s allowed providers. Invalid provider IDs are rejected with a 400 error.

Error Handling

  • Missing pending_auth_id: Returns 400 with error page
  • Expired authorization: Returns 400 with “request expired” message
  • Invalid provider selection: Returns 400 with “invalid provider selection” message
  • Missing required fields: Returns 500 with error page

Key Management

Auto-Generated Keys

By default, FrontMCP generates RS256 keys at startup:
Auto-generated keys are lost on restart. Existing tokens become invalid.

Persistent Keys

Provide keys for stable token validation:

ES256 Keys

Use ES256 for smaller tokens:

Dynamic Client Registration

DCR allows clients to register programmatically. DCR is enabled by default in development.

Registration Request

Registration Response

DCR is intended for development only. In production, pre-register clients. DCR only allows localhost redirect URIs by default.

Per-App Configuration

Configure local auth per app with splitByApp: true:

Token Storage

In-Memory (Development)

Redis (Production)


Enable and customize the consent UI:

Complete Example


Auth UI Template Builders

FrontMCP provides server-side HTML template builders for all authentication UI pages. These render with Tailwind CSS and require no build step.

Customization

Templates accept a ThemeConfig for visual customization:

Layout Variants


Troubleshooting

Auto-generated keys are lost on restart. Either:
  • Provide persistent keys via local.signKey
  • Use Redis for token storage
  • Accept that users must re-authenticate
Ensure you’re using S256 challenge method and the code_verifier matches the original code_challenge.
When running multiple server instances, use Redis for token storage to share session state.

Next Steps

Remote OAuth

Connect to external identity providers

Progressive Authorization

Implement incremental app authorization

Production Checklist

Security requirements for deployment

Tokens & Sessions

Configure token lifetimes