Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Getting error redirect_uri_mismatch when using oAuth

Hello,

I am facing an issue with Google OAuth authentication in a production environment and would appreciate some assistance. Here is a summary of the problem and the steps I have taken so far:

Problem: I have implemented Google OAuth authentication for my web application running on an Ubuntu 22.04 server with Apache. The authentication works perfectly fine when running the application on my local machine, but it fails to work in the production environment.

Steps taken:

  1. Implemented Google OAuth using the Passport.js library in Node.js.
  2. Set up the necessary client ID and client secret in the Google Cloud Console.
  3. Configured the authorized JavaScript origins and redirect URIs in the Google Console.
  4. Verified that the server firewall rules allow outgoing connections to external servers, including the Google OAuth server.
  5. Checked the Apache server logs, but found no errors or relevant information related to the Google OAuth issue.
  6. Restarted the Apache web server and verified that the SSL certificate (Let's Encrypt) is correctly configured.

However, despite these efforts, the Google OAuth authentication continues to fail in the production environment. The authentication flow gets redirected to the Google login page, where I get the error: 'redirect_uri_mismatch'.

I would greatly appreciate any insights or guidance on how to resolve this issue and enable successful Google OAuth authentication in the production environment.

Thank you for your assistance.

2 5 52K
5 REPLIES 5