Google OAuth 2.0 issue

Dear lovely people,

My app is working in local environment but when moved to production I’ve experienced issues with the login.

I have added a custom domain: aa.zerotoadshero.com

I decided to create new Client ID key for production and since then I am getting Error 400: redirect_uri_mismatch

I have replaced the new Client ID key in the environment variables in Vercel.

I have also added Authorised JavaScript origins https://aa.zerotoadshero.com/
And Authorised redirect URIs AI Document Chat
NEXTAUTH_URL is set to https://aa.zerotoadshero.com

Here’s the debug endpoint:

{"nextauth_url":"https://aa.zerotoadshero.com","node_env":"production","vercel_url":"aa-chatbot-b0eglgw1s-kirilmkostov-gmailcoms-projects.vercel.app","vercel_env":"production","callback_url":"https://aa.zerotoadshero.com/api/auth/callback/google"}

I am getting Error 400: redirect_uri_mismatch, I should be able to log in

It’s probably something little that I am not seeing and I hope that a pair of fresh eyes will help me solve this issue.

Any more information please let me know.

Hey, @kirilmkostov-gmailco! Welcome to the Vercel Community :smile:

Took a look at this and noticed that your vercel_url is your .vercel.app URL. Could that be the cause?

"vercel_url":"aa-chatbot-b0eglgw1s-kirilmkostov-gmailcoms-projects.vercel.app"

Shouldn’t it be:

"vercel_url":"aa.zerotoadshero.com"?

Hi and thank you for your response @pawlean.

I think Vercel is assigning domain anyway, but I have mine added, so the app is available at both places…

It seems that everything looks fine but I am yet to overcome the error :frowning:

1 Like

Hi @kirilmkostov-gmailco, thanks for posting the question here.

Were you able to confirm that the Google Auth credentials are same on: Google Cloud Console and Vercel environment variables? It can also be useful to double check the variable names in the codebase after the changes.

I see that the website deployment is not available anymore. Did you face any other issues with the deployment?

I’d love to work together to debug and bring the website live.

1 Like