How to set up Google Login for Discourse

How to set up Google Login for Discourse - How to set up Google Login for Discourse

Once the Discourse site installation and hosting are complete, it is advisable to set up the login environment first. Discourse supports various login methods to make it easy for users to register and log in to the community. I prefer using Google accounts or Facebook and Apple accounts to log in rather than directly registering an account on the site.

Many people also prefer using their existing Google or Apple accounts for privacy protection and more convenient login. On this page, I will share how to set up the Google login environment for the Discourse site.

Create a project for a Google API service

How to set up Google Login for Discourse - Create a project for a Google API service

To create a service for logging into a Google account on the Discourse website, access the Google Cloud page by logging in to the Discourse site.

🌐 Google Cloud

Go to the main page and select the [APIs & Services] menu.

How to set up Google Login for Discourse - Create a project for a Google API service 02

On the [APIs & Services] page, click [Select a project] at the top, then click the [NEW PROJECT] button.

How to set up Google Login for Discourse - Create a project for a Google API service 03

Enter an easily identifiable name in the [Project name] field, and click the [Create] button.

How to set up Google Login for Discourse - Create a project for a Google API service 04
  1. Select the project you just created.
  2. From the left sidebar, choose [OAuth consent screen].
  3. Check the User Type as [External].
  4. Click the [Create] button.
How to set up Google Login for Discourse - Create a project for a Google API service 05
  1. App name: Please enter the name of the website.
  2. User support email: Enter an email account where you can receive actual emails.
  3. Application home page: Enter the homepage address of the website where Google login will be applied.
  4. Application privacy policy: Enter the address of the webpage that contains the website’s privacy policy.
  5. Application terms of service: Enter the link to the terms of service of the website.
  6. Authorized domains: Enter the domain address that has been registered in the Google Search Console.
  7. Developer contact information: Enter an email address where you can be contacted.
How to set up Google Login for Discourse - Create a project for a Google API service 06
  1. Select the project you just created, then click on [Credentials] in the sidebar menu.
  2. On the Credentials page, click on the [CREATE CREDENTIALS] link at the top.
  3. Select OAuth client ID.
How to set up Google Login for Discourse - Create a project for a Google API service 07
  1. Application type: Set the application type to [Web application].
  2. Name: Enter the name of the website where the application will be applied.
  3. Authorized JavaScript origins: Enter the domain address where the API will be used.
  4. Authorized redirect URIs: Add ‘/auth/google_oauth2/callback’ after the domain address where the API will be used.
    For example: https://forum.appflix.cc/auth/google_oauth2/callback
How to set up Google Login for Discourse - Create a project for a Google API service 08

OAuth client creation is complete. The above Client ID and Client secret will be used in the Discourse settings. You can verify them again in the Credentials menu of the project.

Publish your app

How to set up Google Login for Discourse - Create a project for a Google API service 09

The app is currently in the testing state. You need to publish the app for Google account login on Discourse to work properly.

  1. Select the project, then choose [OAuth consent screen] from the sidebar menu.
  2. In the Publishing status section, click [PUBLISH APP].

Enter your Google OAuth Client information in Discourse

How to set up Google Login for Discourse - Enter your Google OAuth Client information in Discourse 01

①. Go to the Admin page.
②. Select the Settings tab.
③. Search for ‘google’ in the settings search bar.
④. Check the [enable google oauth2 logins] setting.
⑤. Enter the issued Client ID.
⑥. Enter the Client secret.

How to set up Google Login for Discourse - Enter your Google OAuth Client information in Discourse 02

Now, try logging in on the Discourse website. If you see the [Sign in with Google] button, the configuration has been successfully completed.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top