Overview
FastApps authentication supports:- OAuth 2.1 with PKCE - Industry-standard authentication
- Built-in JWT Verification - Automatic token validation
- Per-Widget Auth - Granular control with decorators
- Multiple Providers - Auth0, Okta, Azure AD, AWS Cognito
- User Context - Easy access to user claims and permissions
- Scope Enforcement - Server-side permission validation
Why Authentication?
Use authentication to:- Protect sensitive data - Display user-specific information
- Enable write operations - Create, update, or delete resources
- Control access - Restrict features by user role or permission
- Multi-tenant apps - Separate data between users or organizations
Quick Start
1. Install Dependencies
FastApps authentication requires JWT libraries:2. Set Up OAuth Provider
Use an OAuth 2.1 provider that supports:- Dynamic client registration
- PKCE flow
- JWKS for token verification
3. Configure Your Server
Add authentication to yourWidgetMCPServer
:
4. Use Authentication in Widgets
Access user information in your widgets:Authentication Guide
Explore the complete authentication documentation:Server Configuration
Learn how to configure authentication at the server level, including OAuth parameters, audience settings, and built-in JWT verification.Widget Decorators
Control authentication requirements for individual widgets using@auth_required
, @no_auth
, and @optional_auth
decorators.
User Context
Access authenticated user information, claims, and permissions through theUserContext
API.
OAuth Providers
Step-by-step setup guides for Auth0, Okta, Azure AD, and other OAuth 2.1 providers.Advanced Topics
Custom token verification, security best practices, and advanced authentication patterns.Examples
Real-world authentication examples including admin dashboards, personalized content, and role-based access.Troubleshooting
Testing, debugging, and solutions to common authentication issues.How It Works
FastApps uses OAuth 2.1 with PKCE (Proof Key for Code Exchange) to authenticate users:- ChatGPT queries your MCP server for protected resource metadata
- ChatGPT registers itself with your authorization server
- User authenticates when first invoking a protected tool
- ChatGPT obtains an access token
- Your server verifies the token on each request
Next Steps
Ready to add authentication to your widgets?- Server Configuration - Configure OAuth at the server level
- Widget Decorators - Protect specific widgets
- OAuth Providers - Set up Auth0 or other providers
- Examples - See real-world implementations
Need help? Check our GitHub repository or reach out to the community.