Auth middleware for HTTP servers with DCR bearer auth Validates bearer tokens and enriches extra with provider tokens
Pattern:
const provider = new DcrOAuthProvider({ ..., verifyEndpoint: 'http://localhost:3000/oauth/verify' });
const middleware = provider.authMiddleware();
const tools = toolFactories.map(f => f()).map(middleware.withToolAuth);
const resources = resourceFactories.map(f => f()).map(middleware.withResourceAuth);
const prompts = promptFactories.map(f => f()).map(middleware.withPromptAuth);
Get user email from Microsoft Graph API (with caching)
Provider tokens to use for API call
User's email address
Refresh Microsoft access token using refresh token
Microsoft refresh token
New provider tokens
Create Microsoft Graph auth provider from provider tokens
This is the core stateless pattern - provider receives tokens from context (token verification, HTTP request) and creates auth provider on-demand.
Provider tokens (Microsoft access/refresh tokens)
Microsoft Graph-compatible auth provider
DCR Provider - Stateless OAuth provider for Dynamic Client Registration
Unlike LoopbackOAuthProvider which manages token storage, DcrOAuthProvider is stateless:
Pattern: