This guide explains how to set up Google login integration for your Discourse site by configuring OAuth2 credentials in the Google Cloud Console.
Required user level: Administrator
Overview
Google login allows users to sign in to your Discourse site using their Google accounts. This guide will walk you through:
- Creating a Google Cloud project
- Setting up OAuth consent
- Configuring credentials
- Enabling Google login in Discourse
Create a Google Cloud project
- Navigate to
https://console.developers.google.com - Click the project selection button in the top left
- Click “New Project”
- Enter a project name and optional location.
- Click “Create”
If you see any errors after creating the project, refresh the page using Ctrl+F5.
Configure OAuth consent
- Navigate back to
https://console.developers.google.comand select your new project if it is not already slected. - Navigate to “OAuth consent screen” in the left panel. You can also use the top left Google Cloud menu to select “APIs & Services” → “Oauth consent screen”.
- Click “Get Started”
- Under “App Information” enter an app name and select a user-support email address.
- Select “External” Audience
- Next, enter a notifications email address
- Finally, accept the API Services: User Data Policy and click “Create”
Set up credentials
- Navigate to the “APIs & Services” → “Credentials” screen
- Click “Create Credentials” and select “OAuth Client ID”
- Configure the OAuth client:
- Select “Web application” as the Application Type and give it a Name
- In Authorized JavaScript Origins, add your site’s base URL (including
https://) - Add your callback URL under Authorized Redirect URIs:
https://your-discourse-site.com/auth/google_oauth2/callback - Click “Create”
Click on the OAuth 2.0 Client ID:
Copy the ClientID and Client Secret to add to your Discourse admin:
Configure Discourse settings
- In your Discourse admin settings under “Login & authentication”
- Enable the setting
enable google oauth2 logins - Enter your
google oauth2 client id - Enter your
google oauth2 client secret
Verify and publish
Test the integration by adding a user with a Google email address and confirming you can log in to Discourse using the “Log in with Google” option. If you are able to log in then the configuration is complete! ![]()
NOTE:
Previously there was one final step required - changing the Google Developer Project to
productionstatus. This no longer appears to be required. We are leaving these legacy notes here just in case.To make the integration publicly available:
- Change the status to “In production”-
- Complete Google’s verification process
- Verify site ownership through Google Search Console
Additional configuration
Google OAuth2 prompt
The google oauth2 prompt setting controls the behavior of Google’s consent screen during login. Available options:
- (blank) — default Google behavior
-
none— no consent or account selection screen shown -
consent— always show consent screen -
select_account— always prompt the user to select an account
Google Workspace (formerly G. Suite, Google Apps) login
To restrict login to specific Google Workspace domains:
- In
Discourse Admin -> Login & authentication, locate thegoogle oauth2 hdsite setting - Enter your Google Workspace domain
Google Workspace group sync
You can automatically sync Google Workspace groups with Discourse. This requires:
- Enable the
google oauth2 hd groupssetting - Set
google oauth2 hdto your Workspace domain - Enter a Workspace admin email in
google oauth2 hd groups service account admin email - Paste your Google service account JSON credentials into
google oauth2 hd groups service account json
The service account must have domain-wide delegation enabled and be granted the https://www.googleapis.com/auth/admin.directory.group.readonly scope. See Google’s documentation on domain-wide delegation for setup instructions.
Troubleshooting
If you experience login issues:
- Verify that HTTPS is properly configured
- Double-check all redirect URIs
- Ensure your site’s SSL certificate is valid
- Confirm that all required Google Cloud APIs are enabled
- Enable
google oauth2 verbose loggingto get detailed OAuth2 request/response logs
Related resources
- https://developers.google.com/identity/protocols/oauth2/web-server
- Perform Google Search Console Verification with Discourse
Last edited by @southpaw 2025-03-11T02:06:51Z
Check document
Perform check on document:









