Title: "Google login page shows 'Access denied' error: OAuth 2.0 redirect_uri_mismatch"

122 Views Asked by At

Body: I'm implementing Google login functionality in my web application using OAuth 2.0. However, when I click on the Google login button and get redirected to the Google login page, I receive an 'Access denied' error. The error message states: "You can't sign in because this app sent an invalid request. Error 400: redirect_uri_mismatch".

Here are the steps I have taken so far:

  • I have set up the necessary client ID and client secret in my application.
  • I have specified the authorized JavaScript origins and redirect URIs correctly.
  • I have checked the redirect URI in both my code and the Google Cloud Console, and they match exactly.

However, I still encounter the Access denied error. I have also referred to the Google documentation on handling redirect_uri_mismatch errors but haven't been able to resolve the issue.

Can someone please help me identify the cause of this error and suggest a solution? I would greatly appreciate any guidance or insights into resolving this issue.

Code Snippet: [Include relevant code snippets related to the OAuth 2.0 setup and the callback route if applicable.]

Error Message:

The error message I receive is: "You can't sign in because this app sent an invalid request. Error 400: redirect_uri_mismatch".

Any help or suggestions would be highly appreciated. Thank you in advance!

What I have tried:

  • I have double-checked the authorized JavaScript origins and redirect URIs in both my code and the Google Cloud Console, ensuring they match.
  • I have regenerated the client ID and client secret, updating them in my application.
  • I have cleared my browser cache and tried accessing the Google login page again.
  • I have referred to the Google documentation on handling redirect_uri_mismatch errors and followed the suggested steps, but the issue persists.

What I was expecting: I expected that after clicking on the Google login button, I would be redirected to the Google login page and prompted to authorize the application. Upon successful authorization, I should be redirected back to my application with the necessary authorization code or access token.

However, instead of the expected behavior, I am receiving an Access denied error with the message:

"You can't sign in because this app sent an invalid request. Error 400: redirect_uri_mismatch".

Based on the steps I have taken and the error message received, I am seeking guidance on how to resolve this issue and successfully implement Google login in my web application.

0

There are 0 best solutions below