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

We Are Going To Discuss About Google oAuth 2.0 API Authentication Error: Error 400 – redirect_uri_mismatch (does not comply with policy) DJANGO APP. So lets Start this Python Article.

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

  1. How to solve Google oAuth 2.0 API Authentication Error: Error 400 – redirect_uri_mismatch (does not comply with policy) DJANGO APP

    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.

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

  2. Google oAuth 2.0 API Authentication Error: Error 400 – redirect_uri_mismatch (does not comply with policy) DJANGO APP

    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.

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

Solution 1

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

Original Author Zach Of This Content

Solution 2

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.

Original Author Mohamed ElNady Of This Content

Solution 3

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

Original Author Prathamesh Vichare Of This Content

Solution 4

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

Original Author Fakhar Abbas Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment