Token Types
Session Modes
FrontMCP supports two session management strategies:Stateful Sessions
Tokens stored server-side. Clients hold lightweight references.Pros:
- Silent token refresh
- Revocation without client update
- Secure token storage
- Requires shared storage (Redis)
- State management complexity
Stateless Sessions
All data embedded in JWT. No server-side storage.Pros:
- Horizontally scalable
- No shared state
- Simple architecture
- No silent refresh
- Larger token size
- Can’t revoke without expiry
Stateful Session Configuration
Stateless Session Configuration
Token Storage
In-Memory (Development)
In-memory storage loses all data on restart. Use only for development.
Redis (Production)
Storage Contents
OrchestratedTokenStore Interface
When using local or remote mode with federated authentication, FrontMCP stores provider tokens using theOrchestratedTokenStore interface.
Interface Methods
Token Migration
ThemigrateTokens() method is used internally during federated auth completion to transfer tokens from a pending authorization ID to the final authorization ID:
migrateTokens() is called automatically during the OAuth token exchange flow when completing federated authentication.Token Lifetimes
FrontMCP uses default token lifetimes:Token Refresh Configuration
Token lifetimes are currently set at the server level. Refresh tokens are rotated on each use per OAuth 2.1 best practices.
Token Refresh Flow
Refresh tokens are rotated on each use (OAuth 2.1 best practice):JWT Structure
Access tokens are JWTs with standard claims:Custom Claims
Add custom claims to tokens:Consent & Scopes
Enable consent to let users select granted permissions:How Consent Works
- User authenticates
- FrontMCP displays available tools/resources/prompts
- User selects which to grant
- Access token includes only selected scopes
Tool-Level Scopes
JWKS Management
FrontMCP manages cryptographic keys for token signing:Auto-Generated Keys
By default, keys are auto-generated at startup:Persistent Keys
Provide keys for stable token validation across restarts:Key Rotation
For production, implement key rotation:Token Verification
Verification Flow
Verification Options
Error Responses
Token-related errors follow OAuth 2.0 error format:Example Error Response
Next Steps
Authorization Modes
Choose the right auth mode for your use case
Progressive Authorization
Implement incremental app authorization
Production Checklist
Security requirements for deployment
Remote OAuth
Connect to external identity providers