Auth.js · GitHub page
GitHub: redirect_uri mismatch
error=redirect_uri_mismatch · The redirect_uri is not associated with this application.What it means
The callback URL Auth.js sent to GitHub doesn't match the one registered on your GitHub OAuth app. A GitHub OAuth app has one callback URL, so the app you made for localhost can't also serve production.
Common causes
- Signing in on production with the localhost OAuth app's client ID
- http vs https, www vs no www, or a different port
- A preview deployment URL that changes on every deploy
How to fix it
- Create a second GitHub OAuth app for production (github.com/settings/developers)
- Set its callback URL to https://your-domain.com/api/auth/callback/github
- Put that app's ID and secret in production as AUTH_GITHUB_ID and AUTH_GITHUB_SECRET
- For previews, Auth.js supports a stable redirect proxy via AUTH_REDIRECT_PROXY_URL
Homepage URL: https://your-domain.com
Callback URL: https://your-domain.com/api/auth/callback/githubPrompt for Cursor or Claude Code
GitHub sign-in fails in production with redirect_uri_mismatch. List the exact callback URL my app sends (base path /api/auth, provider github) for my production domain, and the env vars I need for a separate production GitHub OAuth app.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Auth.js error fixer.
next: skip the next one
Skip the debugging. The VibeBoot SaaS Starter ships with this already handled: src/auth.ts sets trustHost and ships GitHub sign-in, and .env.example documents AUTH_SECRET and the GitHub callback URL. Plus Stripe and a database on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Auth.js errors
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.