Quick setup
Two routes handle the full OAuth flow: redirect to the provider and handle the callback.app/api/auth/github/route.ts
app/api/auth/github/callback/route.ts
.env
/api/auth/github to start the flow. After authorization, they’re redirected back to your callback route with tokens.
Available providers
Pre-configured providers include: GitHub, Google, Discord, Slack, Twitter/X, Facebook, LinkedIn, Microsoft, Apple, Spotify, Twitch, Notion, Figma, Linear, Jira, Confluence, Dropbox, Box, Zoom, HubSpot, Salesforce, Stripe, Shopify, GitLab, Bitbucket, and more. Each provider exports a config object (e.g.,githubConfig, gmailConfig, discordConfig).
Token storage
By default, tokens are stored in memory (lost on restart). For production, implement a persistent store:Status and disconnect
Check if a user is connected, or disconnect them:app/api/auth/github/status/route.ts
Custom OAuth provider
For providers not included, create your own config:Next
- MCP Server: expose your tools over the Model Context Protocol
- Configuration: environment variables and secrets
Related
veryfront/oauth: OAuth API reference