NextAuth redirect URI mismatch when using custom API path /api/v1/auth #13268
Unanswered
akashdeep023
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m using NextAuth.js with a custom base path
/api/v1/auth
.Everything works perfectly in local development, but in production (Vercel) I get a Google OAuth error:
redirect_uri_mismatch
even though the redirect URL in the Google Cloud Console matches exactly what NextAuth generates locally.Environment
[email protected]
.env
app/provider.ts
File structure
/app/api/v1/auth/[...nextauth]/route.ts
Expected Behavior
Google OAuth should redirect correctly to:
https://mydomain..vercel.app/api/v1/auth/callback/google
Actual Behavior
After sign-in, the redirect URL generated by NextAuth is:
https://mydomain..vercel.app/api/auth/callback/google
Images



Beta Was this translation helpful? Give feedback.
All reactions