Google OAuth2 integration Error 400: redirect_uri_mismatch

I'm getting this error Error 400: redirect_uri_mismatch even after giving the proper redirect uri. You can check the images below for the reference. It works for my localhost but it shows this error for my server. My domain looks like I'm not able to find the possible cause of this issue after surfing most of the issues related to this error. Although, I guess the issue maybe because I'm using a subdomain here, but still not sure if its the issue.

Application info:

  • frontend is in react hosted on
  • backend is in spring boot hosted on

enter image description here

enter image description here

1 answer

  • answered 2021-09-06 11:32 DaImTo

    Your application is sending from as http to a .com domain

    enter image description here

    In google developer console you have only one http domain listed and that is localhost

    enter image description here

    The redirect uri you are sending from must exactly match one that you have added in google cloud console.

    To understand how to set up your redirect uri properly check Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.

    where is the redirect uri comming from

    Depending upon the programing language, the ide and the client library you may be using will define what redirect uri your application is calling from.

    For example i know that visual studio likes to add random ports with C#. I cant tell you what is generating your redirect uri i can only tell you that

    The following needs to be added to your google cloud console.   

    or you need to figuer out what is setting the host on your requests and set it to use https so that you can use the one that you have there now   

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum