# 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:** 7
**Page:** 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>

> 🔖 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:

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)

ℹ 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! 🎉

> ⚠ 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:

---

<div class="post-metadata">

### Author: ![Deenius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deenius/32/369129_2.png) [@Deenius](https://meta.discourse.org/u/Deenius)
#### Post date: [July 17, 2024, 8:21am UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/255 "2024-07-17T08:21:08Z")

</div>

Unfortunately, if I follow the instructions, the login does not work.

In order to get the login to work, I had to add both URL formats for redirection.

[https://forum.example.com//auth/google\_oauth2/callback](https://forum.example.com//auth/google_oauth2/callback) http:///forum.example.comauth/google\_oauth2/callback

However, I am now unable to submit the app for publication because Google only requires addresses in the HTTPS format.

Any advice on how to solve this?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 17, 2024, 2:39pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/256 "2024-07-17T14:39:17Z")

</div>

I guess you don’t have a [standard install](https://meta.discourse.org/t/142537?silent=true) and need to turn on `force_https`.

---

<div class="post-metadata">

### Author: ![Deenius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deenius/32/369129_2.png) [@Deenius](https://meta.discourse.org/u/Deenius)
#### Post date: [July 17, 2024, 3:47pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/257 "2024-07-17T15:47:08Z")

</div>

I followed the official installation. Force HTTPS is enabled.

EDIT: It’s weird, but now it’s started to work! I tried it at least ten times before, but it didn’t work.

I can’t explain it because the procedure was exactly the same. Maybe something on Google’s side?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 17, 2024, 5:47pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/258 "2024-07-17T17:47:01Z")

</div>

🤷 It makes no sense that it’d be accessing google with `http`.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [December 5, 2024, 8:44pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/259 "2024-12-05T20:44:43Z")

</div>

A post was split to a new topic: [Google login regression, possibly after recent changes](https://meta.discourse.org/t/google-login-regression-possibly-after-recent-changes/340725)

---

<div class="post-metadata">

### Author: ![patrickemin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrickemin/32/520162_2.png) [@patrickemin](https://meta.discourse.org/u/patrickemin)
#### Post date: [July 15, 2025, 5:06pm UTC](https://meta.discourse.org/t/configure-google-login-for-discourse/15858/261 "2025-07-15T17:06:01Z")

</div>

Hello, thank you, I set up the procedure today and it works fine. I tested it with another Google account that belongs to me. However I have a small question, I tried to register with this other Google account from my PC and I only got the access key option. I had to activate Bluetooth to communicate with my phone. Well, all that didn’t work at all. What I really wanted to do was click on the connect with Google button and then complete the procedure by simply filling in the form without using an access key. I’m on my PC, I don’t necessarily have an access key, no fingerprint. What do I do if I want to use this procedure, register with Google if I’m not on my phone? Thanks.
