[Fixed]-Google oAuth 2.0 API Authentication Error: Error 400 – redirect_uri_mismatch (does not comply with policy) DJANGO APP

10👍

google’s documentation is not clear on this part (probably a bug on google’s end too):

go to your GCP console, under OAuth consent screen, when the Publishing status is In production, we can still put http://localhost:8080/oauth-authorized/google under the Authorized redirect URIs without triggering the red error message saying Invalid Redirect. However, it doesn’t work unless the app is in Testing status.

enter image description here

so in order to test your app at http://127.0.0.1:8000, you need to bring your GCP app to Testing status

enter image description here

👤Zach

1👍

hey i was dealing with this problem in ASP.Net MVC,
i think the reason would be the same in php but anyways,
Make sure to copy that url in ur below img to Authorized redirect URIs in OAuth 2.0 Client IDs in Google cloud console.

1👍

Copy the url that comes with the error message you get and add it to the authorize redirect uris in your google cloud console

0👍

Check if you are logged in to your google account.

I was using google chrome browser and turns out I was logged out of Gmail as the session expired and when I logged into Gmail and the issue was resolved

0👍

In my case, it working in development environment and not in production environment. Enabling API KEY for production resolved the issue.

0👍

In my case I needed to change my redirect URI from

https://{{my-url}}/google/endpoint

To

https://www.{{my-url}}/google/endpoint
👤Sam

Leave a comment