Auth.js · browser URL
Redirected to localhost after deploy
https://your-app.com → sign in → http://localhost:3000/api/auth/callback/githubWhat it means
If AUTH_URL or NEXTAUTH_URL is set, next-auth v5 rewrites the request's origin to it. A localhost value copied into production sends every user back to localhost.
Common causes
- NEXTAUTH_URL=http://localhost:3000 copied from a v4 tutorial into the host's env vars
- AUTH_URL left over from local testing
How to fix it
- Delete AUTH_URL and NEXTAUTH_URL from production. v5 infers the host from the request
- Only set AUTH_URL when Auth.js lives under a different base path
- Redeploy
Prompt for Cursor or Claude Code
After deploying, sign-in sends users to localhost. Find every place AUTH_URL or NEXTAUTH_URL is set or read, and tell me which ones to remove for production on Auth.js v5.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 setup. The VibeBoot SaaS Starter ships Auth.js v5 already wired (GitHub sign-in, optional email magic links, Prisma adapter), 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.