Configuring Google login for Discourse

(Neil Lalonde) #1

Here’s how to configure Discourse to allow login and registration with Google OAuth2.

  1. Go to, on the top left click on Select a project

  2. On the top right, click on New Project

  3. Fill in the project fields. You can also edit the Project ID (optional), then click on Create
    (This can take a while, so wait a minute as needed for it to appear.)

    3a. It is possible that errors are displayed after creating the project. Ignore them and refresh the page with Ctrl+F5

  4. Select your project clicking on the project name

  5. Open the dropdown menu clicking on Create credentials and choose OAuth client ID .

  6. Configure your OAuth Consent Screen.

    6a.Fill as appropriate; we recommend populating all these fields, then click Save.
    In the example below we use, be sure to use the URL of your Discourse site including http:// or https:// .

  7. Choose “Web application” as the Application Type.
    In the Authorized JavaScript Origins section, add your site’s base url, including http:// or https://.
    In the Authorized Redirect URI section, add the base url with /auth/google_oauth2/callback. Click the Create button.

  8. The OAuth client dialog will appear with client ID and secret.

  9. In your Discourse site settings, check “enable google oauth2 logins”, and fill in your google oauth2 client id and google auth2 client secret provided earlier.

That’s it, Google login should now work on your Discourse! Go ahead and test it out with any Google account.

Configure oauth callback urls
Google and linkedin Login/Signin stoped working
Configure oauth callback urls
Oauth Login requests 'offline access'
How to setup google oAuth2 on site?
Google Login Stopped Working
User should be able to login without verification
[Paid] Discourse configuration changes
Mysterious Google Cloud project
Sso with google account
Restrict Google OAuth2 to a domain
Getting Error on setting up Google Sign-in
Google login errors
(Chuck Kalish) #157

I think I got Google in order, but I might now be misconfigured in Discourse. After clicking “with Google” I get this error in a Discourse window:

Sorry, there was an error authorizing your account. Perhaps you did not approve authorization?

Is that on the google authenticating side, or on the discourse side?


(Stephen) #158

Usually this means one or more APIs weren’t enabled AFAIK?

Check which project they were configured against. That still catches me out occasionally.

(jdorfman) #159

I’m having the same issue as @Chuck_Kalish. Any help would be appreciated.

(Stephen) #160

Which APIs have you enabled against the project you set up for Google login to your site?

(jdorfman) #161

We have GitHub and Twitter OAuth working if that is what you mean.

(Stephen) #162

No, I mean when you configured Google authentication one of the steps was to create a project and enable specific APIs at the developer console. Which APIs did you enable?

(jdorfman) #163

Does this help?

Sorry I’m a noob =p

(Stephen) #164

Go back to the Dashboard and look at the bottom - that’s where specific APIs are listed. Both Contacts API and Google+ API should be listed:


(jdorfman) #165

it works. Thanks @Stephen!

(Stephen) #166

Excellent, glad to hear it.

(Neil Lalonde) #167

I’m curious about this solution. Our instructions currently only say you need Google+ API. Should we add the Contacts API too?

(Joshua Rosenfeld) #168

Shouldn’t need it. Both @Dax and I tested this last month and only enabled the Google+ API. Looking at the edit history we removed Contacts API from the instructions in Dec 2017.

(Stephen) #169

Cool, looks like it was just Google+ he was missing then (hope that gets renamed soon) - @jdorfman can you confirm what you added yesterday?

(jdorfman) #170

I added both even though I thought Google+ was shutting down soon.

(Stephen) #171

Google+ the social network will go away, yes, but that login API will be sticking around for the foreseeable future, although maybe with a different name.

(RBoy) #173

Received this today, any changes to be made?

Hello Google+ Developer,

We’re writing to let you know that as part of the sunset of the consumer version of Google+, we will be shutting down our Google+ APIs on March 7, 2019. As part of these changes, Google+ Sign-in has been fully deprecated and will also be shut down on March 7, 2019.

What do I need to know?

On March 7, 2019, all Google+ APIs and Google+ Sign-in will be shut down completely. This will be a progressive shutdown beginning in late January, with calls to these APIs starting to intermittently fail as early as January 28, 2019.

What do I need to do?

Please update your projects listed below by March 7, 2019 and ensure they are no longer using Google+ APIs. The data below shows which Google+ API methods your projects have recently called.

Note: If you see calls to people.get , these can be the result of using the Google+ Sign-In feature in your application, which is now fully deprecated and is being shut down. Developers should migrate from the Google+ Sign-In feature to the more comprehensive Google Sign-in authentication system.

(Oskar Weigl) #174

I also got the same email. Just want to add the details of “The data below shows which Google+ API methods your projects have recently called.”:

Is it likely that there would be code and a migration guide ready for the March deadline?

(Jeff Atwood) #175

Certainly, @jomaxro will switch our meta / try Google logins to the “new way” soon and document that in the first post.

(Rafael dos Santos Silva) #176

I think we need to wait for fixes upstream: