Google Sign-In Redirect URL for OpenEMR - Need Help!

Hi everyone,

I’m trying to enable Google Sign-In on my OpenEMR instance and I’m running into a bit of a snag. I’ve followed all the steps I could find:

  • Added the Google client secret to the OpenEMR configuration.
  • Set up the Google Cloud Console project correctly.

The only remaining piece I need is the Redirect URL to configure in the Google Cloud Console. Once I have the correct redirect URL, I believe my Google Sign-In should function correctly.

Could anyone who has successfully implemented Google Sign-In for OpenEMR share their redirect URL configuration? Any guidance or suggestions would be greatly appreciated! I’m really looking forward to getting this working.

Thanks in advance for your help!

To set up Google Sign-In Redirect URL for OpenEMR, follow these steps to troubleshoot and configure it properly:


Step 1: Configure Google OAuth in Google Cloud Console

  1. Go to the Google Cloud Console:
    :point_right: https://console.cloud.google.com/
  2. Navigate to APIs & Services > Credentials.
  3. Click Create Credentials > OAuth 2.0 Client ID.
  4. Choose Web Application as the application type.
  5. Under Authorized Redirect URIs, add:

ruby

Copy code

https://your-openemr-url/interface/modules/zend_modules/public/login/google

6.(Replace your-openemr-url with your actual domain.)*
7. Click Create and save the Client ID & Secret.


Step 2: Configure OpenEMR to Use Google Sign-In

  1. Open your OpenEMR configuration file:

arduino

Copy code

/etc/openemr/config.php
  1. Locate the OAuth settings and add/update:

php

Copy code

$GLOBALS['google_client_id'] = 'YOUR_GOOGLE_CLIENT_ID';
$GLOBALS['google_client_secret'] = 'YOUR_GOOGLE_CLIENT_SECRET';
$GLOBALS['google_redirect_url'] = 'https://your-openemr-url/interface/modules/zend_modules/public/login/google';
  1. Save the changes.

Step 3: Verify and Test

  1. Clear your cache and cookies.
  2. Try logging in with Google Sign-In from OpenEMR.
  3. If you get an error like “Redirect URI Mismatch”, go back to Google Cloud Console and ensure:
  • The redirect URI exactly matches the one configured in OpenEMR.
  • There are no trailing slashes or typos.

Step 4: Enable Google API Access (If Needed)

If you get an authentication error, enable:

  • Google People API
  • Google Identity Toolkit API

Step 5: Debugging Tips

  • Check Apache/Nginx logs for errors:

bash

Copy code

tail -f /var/log/apache2/error.log
  • Inspect OpenEMR logs:

bash

Copy code

tail -f /var/log/openemr.log
  • Use Google OAuth Playground (link) to test authentication.

If you’re still facing issues, let me know the exact error message, and I’ll guide you further! schedule you free support meeting.