# Configure Google login for Discourse

**URL:** https://meta.discourse.org/t/configure-google-login-for-discourse/15858
**Category:** Integrations
**Tags:** sso, how-to, social-auth
**Created:** [May 21, 2014, 10:46pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858 "2014-05-21T22:46:55Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [May 21, 2014, 10:46pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/1 "2014-05-21T22:46:55Z")

</div>

> :bookmark: This guide explains how to set up Google login integration for your Discourse site by configuring OAuth2 credentials in the Google Cloud Console.
> 
> :person_raising_hand: 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:

1. Creating a Google Cloud project
2. Setting up OAuth consent
3. Configuring credentials
4. Enabling Google login in Discourse

## Create a Google Cloud project

1. Navigate to `https://console.developers.google.com`
2. Click the project selection button in the top left
3. Click “New Project”

 ![Create a New Project in Google Cloud admin](https://global.discourse-cdn.com/meta/original/4X/d/9/b/d9b99b45a5ff9119c1d5715c2692d164ac075133.jpeg)

1. Enter a project name and optional location.
2. Click “Create”

 ![Google Cloud Project Creation Form](https://global.discourse-cdn.com/meta/original/4X/6/3/e/63ea03e0bd7ba5f1a6132abfa038281cee9b8d88.png)

:information_source: If you see any errors after creating the project, refresh the page using Ctrl+F5.

## Configure OAuth consent

1. Navigate back to `https://console.developers.google.com` and select your new project if it is not already slected.
2. 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”.

 ![Google OAuth Consent](https://global.discourse-cdn.com/meta/original/4X/5/4/0/5408ae2324cd23c04d8f830600ae325b0c6b3f97.png)

1. Click “Get Started”
2. Under “App Information” enter an app name and select a [user-support email address](https://support.google.com/cloud/answer/10311615#user-support-email&zippy=%2Cuser-support-email).

 ![Google Cloud Admin App Information Form](https://global.discourse-cdn.com/meta/original/4X/6/e/9/6e9092606ddee7bb650cf8a576b0b6e56bb7310f.png)

1. Select “External” Audience

 ![Select External Audience](https://global.discourse-cdn.com/meta/original/4X/1/0/6/106cc39c04247dba32f13766765e99d3b742d152.png)

1. Next, enter a notifications email address
2. Finally, accept the API Services: User Data Policy and click “Create”

## Set up credentials

1. Navigate to the “APIs & Services” → “Credentials” screen
2. Click “Create Credentials” and select “OAuth Client ID”

 ![Create OAuth Credentials](https://global.discourse-cdn.com/meta/original/4X/b/d/8/bd834c0e28e723dd7c693e4ebc0fbe8920938165.jpeg)

1. 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”

 ![Configure OAuth Client](https://global.discourse-cdn.com/meta/original/4X/d/c/3/dc355515f2516bc3ba572576faca64f6ab805e87.jpeg)

Click on the OAuth 2.0 Client ID:

 ![Select Oauth Client ID](https://global.discourse-cdn.com/meta/original/4X/0/8/b/08be5f5e7291293db70aac421f65f2e5be6954e4.jpeg)

Copy the ClientID and Client Secret to add to your Discourse admin:

 ![Copy ClientID and Client Secret](https://global.discourse-cdn.com/meta/original/4X/f/0/6/f061a4dbf1358291e6e6c960e7e0263e274ecaa5.jpeg)

## Configure Discourse settings

1. 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`

 ![Configure Discourse Settings](https://global.discourse-cdn.com/meta/original/4X/d/8/6/d8643b5b2e44c06e32dfe0b3a8f43f370f142114.jpeg)

## 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! :tada:

> :warning: NOTE:
> 
> Previously there was one final step required - changing the Google Developer Project to `production` status. 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:

1. In `Discourse Admin -> Login & authentication`, locate the `google oauth2 hd` site setting
2. Enter your Google Workspace domain

### Google Workspace group sync

You can automatically sync Google Workspace groups with Discourse. This requires:

1. Enable the `google oauth2 hd groups` setting
2. Set `google oauth2 hd` to your Workspace domain
3. Enter a Workspace admin email in `google oauth2 hd groups service account admin email`
4. 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](https://developers.google.com/identity/protocols/oauth2/service-account#delegatingauthority) 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 logging` to get detailed OAuth2 request/response logs

## Related resources

- [Using OAuth 2.0 for Web Server Applications &nbsp;|&nbsp; Authorization &nbsp;|&nbsp; Google for Developers](https://developers.google.com/identity/protocols/oauth2/web-server)
- [Perform Google Search Console Verification with Discourse](https://meta.discourse.org/t/how-to-perform-google-search-console-a-k-a-google-webmaster-tools-verification-with-discourse/107229)

> Last edited by @southpaw 2025-03-11T02:06:51Z
> 
> > **Check document**
> >
> > Perform check on document:

---

_[View the full topic](https://meta.discourse.org/t/configure-google-login-for-discourse/15858)._
