Google OAuth2 Authentication
We’re currently making rapid changes to the product so our docs may be out of date. If you need help, please email yo@forem.com.
Forem allows you to authenticate using Google OAuth2. To use this authentication method in local development, you will need to set up Google client application and retrieve its keys. Then you'll need to provide these keys to the Rails application.
Google Admin Console.
Click this link to create a new OAuth application in your Google console - you will be redirected to sign in to Google account if you have not already.
Go to OAuth Consent Screen section. Set the Publishing Status to Testing.
Add your test user email to the Test Users section.
Go to the Credentials section and at the top of the screen click Create Credentials -> OAuth Client ID.
Select Web Application as the Application Type, and name it.
Under Authorized Redirect URIs add the URI
http://localhost:3000/users/auth/google_oauth2/callback
. Replace the port3000
if you run Forem on another port.On the resulting screen you'll find your app's Client ID and Client Secret. Make a note of them.
Click OAuth Consent Screen in the sidebar, then click Edit App next to your app's name.
Fill out the information on the resulting Edit App Registration screen, then click Next Step.
On the next screen, Scopes, click Add or Remove Scopes.
Click the checkboxes next to the first two unlabeled scopes in the Updated Selected Scopes section.
Complete the rest of the app registration screens.
Your Forem
Enable the Google Authentication provider in the admin dashboard, entering the Client ID and Client Key from step 7.
Done.