Multiple projects with single google sign in
# support
l
Hello, I am self-hosting on GCP and have a question about using Google Authentication. If I log in to my account via email/password, I see the two projects that my account is part of. If I log in to the same account via Google sign-in, it seems to just pick the first project my account was associated with. Is there a way to associate the Google sign in with multiple projects? I also have run into an issue where my Google Client ID works great for signing-in to medplum, but when I use Google for registration, it says invalid Google Client ID. Any idea why it would for one but not the other? I don't see anything obvious. Thanks for your help!
r
Would you be able to screencap/video your login where it does not show you the profile selection using Google Auth? That behavior is unexpected. Regarding your second issue with the Google Client ID working for sign-in but not for registration, this could be related to how the Google OAuth credentials are configured. When setting up Google credentials for Medplum, you need to ensure: 1. The correct authorized JavaScript origins are set to your domain 2. The authorized redirect URIs include your domain's login callback path 3. The OAuth consent screen is properly configured with the required scopes . To troubleshoot: - Verify your Google Client ID is correctly configured in your Medplum configuration - Check that all required scopes are included in your Google OAuth setup - Ensure your redirect URIs are properly configured for both sign-in and registration flows Because you are self hosting check your server configuration to ensure the Google Client Secret is properly set in your server config: googleClientSecret: "your-google-client-secret"
l
I am attaching the requested video. In the video you can't see the pop-up sign in window, but I selected the same account I used to log-in with. My Google Client ID is correctly added to the env variables in Cloud Run. I have all the required scopes per the Google Auth set up documentation page. I have several URIs to try and catch all possibilities. The server is at: https://fhir.precisionlongevity.io/ The app is at: https://app.fhir.precisionlongevity.io/ The URIs are: https://fhir.precisionlongevity.io/auth/google https://fhir.precisionlongevity.io/auth/callback https://fhir.precisionlongevity.io/auth/google/callback I have the same ones again with the app.* to cover the app origins as well. Why would it work on sign-in with google but not with register though? https://cdn.discordapp.com/attachments/1374562115779563661/1375149289126494208/Screen_Recording_2025-05-22_at_11.26.10_AM.mov?ex=6830a313&is=682f5193&hm=5ac7860d275eb20930d67eac861f646600c52450231c1298cb6d478621cab2c9&
r
Thanks for this - helpful. Is registerEnabled in your settings? https://www.medplum.com/docs/self-hosting/config-settings#registerenabled
l
Register is enabled. The app puts out the message "Invalid Google Client ID", but only during registration.
r
Register will require correctly configured Recaptcha - is your site registered with the provided Client Id? https://www.google.com/recaptcha/admin/create
l
I have created a recaptcha and the site has the recaptcha site key in the env variables. The server has both the recaptcha site key and secret as variables.
It seems that while the env variables were set correctly, they weren't being picked up in the config. I did an override command to add the argument "env:" to the container and that seems to be working now. Even the selection of multiple projects is working too.
154 Views