Steps
-
Go to https://console.developers.google.com, on the top left click on Select a project
-
On the top right, click on New Project
-
Fill in the Project Name field. 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
-
Select your project by clicking on the project name, click on OAuth consent screen on the left panel (if you can’t find it, search using the search box at the top), select External and then click on Create
-
Fill as appropriate; we recommend populating all these fields, then click Save.
In the example below we usehttps://demo.site.com
, be sure to use the URL of your Discourse site includinghttp://
orhttps://
. All our hosted customers have HTTPS active by default.As of 2021/09/13 (September 13), Google will require you to use https.
Noting that changing the Application logo, Google will ask to verify the site
-
Go to the Credentials tab on the left, click on + CREATE CREDENTIALS and then click on OAuth client ID
-
Choose Web application as the Application Type.
In the Authorized JavaScript Origins section, add your site’s base url, includinghttp://
orhttps://
.
In the Authorized Redirect URI section, add the base url with/auth/google_oauth2/callback
. Click the Create button.As of 2021/09/13 (September 13), Google will require you to use https.
-
The OAuth client dialog will appear with client ID and secret.
-
(Optional) From your project, clicking on Credentials from now on you will find the OAuth credentials to edit or delete
-
In your Discourse site settings, check
enable google oauth2 logins
, and fill in yourgoogle oauth2 client id
andgoogle auth2 client secret
provided earlier. -
Your ‘project’ will have the ‘Testing’ status. Add a google user, and test that it is working.
-
To get it fully working, you now have to change the status to
In production
. This means filling in a few more things, and submitting it for verification. For details see, OAuth App Verification Help Center - Google Cloud Platform Console Help
-
You will need to confirm your ownership of the site via the Google Search Console to make Google happy. See this:
That’s it, Google login should now work on your Discourse! Go ahead and test it out with any Google account.
Tips
To enable Gsuite login enable the site setting google oauth2 hd
. More info at more info here. The ID token will be validated by Discourse.
Translations
These guides have been translated by and are maintained by the community.
Last Reviewed by @SaraDev on 2022-05-24T20:00:00Z
Last edited by @JammyDodger 2024-05-26T07:25:27Z
Check document
Perform check on document: