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

  1. Go to https://console.developers.google.com and create a new Project. Wait a minute as needed for it to appear.

  2. In the new project, in the menu on the left, click “APIs & auth” > Credentials.

  3. Go ahead and click Configure Consent Screen button. Fill as appropriate; we recommend populating all these fields!

  4. 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 Client ID button.

  5. The web application will appear with its client ID and secret.

  6. Under “APIs & auth” > APIs, you’ll see a huge list. Find “Contacts API” and “Google+ API”. Enable both of them.

  7. In your Discourse site settings, check “enable google oauth2 logins”, and fill in your client id and client secret from step 4.

HTTPS

If you’re using SSL and are getting errors when authenticating with Google OAuth2, see this topic.

Source: https://meta.discourse.org/t/configuring-google-oauth2-login-for-discourse/15858