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 authMiddleware = provider.authMiddleware();
const tools = toolFactories.map(f => f()).map(authMiddleware.withToolAuth);
const resources = resourceFactories.map(f => f()).map(authMiddleware.withResourceAuth);
const prompts = promptFactories.map(f => f()).map(authMiddleware.withPromptAuth);
Get user email from Google userinfo API (with caching)
Provider tokens to use for API call
User's email address
Refresh Google access token using refresh token
Google refresh token
New provider tokens
Token provider built from verification-supplied tokens.
This is the core stateless pattern - the provider receives tokens from context (token verification, HTTP request) rather than owning a store.
Provider tokens (Google access/refresh tokens)
DCR Provider - Stateless OAuth provider for Dynamic Client Registration
Unlike LoopbackOAuthProvider which manages token storage, DcrOAuthProvider is stateless:
Pattern: