Set up OAuth in Google Cloud - nicmart-dev/linguistnow GitHub Wiki
The React app and Express server use OAuth 2.0 Client ID and secret created for Google authentication
The client ID and secret can always be accessed from Credentials in APIs & Services https://console.cloud.google.com/apis/credentials
Google API client ID setup instructions
Create project
-
Click
CREATE PROJECT
button, choose any name
Configure consent screen
-
Click
CONFIGURE CONSENT SCREEN
button or go to your OAuth Consent Screen https://console.cloud.google.com/apis/credentials/consent -
Select
External
and clickCREATE
button -
Fill in mandatory fields and click
SAVE AND CONTINUE
button, and click that button again in theScopes
screen -
Add your account email as test user with
ADD USERS
button, clickSAVE AND CONTINUE
button
Note: please set up at least 2 Google accounts to use as test users, one of which we will later set up in Airtable with Project Manager
role (the other being created automatically upon first login in the app with Linguist
role.
Create credentials
-
Go to Credentials page https://console.cloud.google.com/apis/credentials
-
Click
Create credentials
button and selectOAuth client ID
-
In the Application type dropdown, select
Web application
and give it a recognizable name likegoogle-auth-library
-
Under
Authorized redirect URIs
, select + ADD URI. Paste inhttp://localhost:3000
. You may also want to sethttp://localhost:3000
http://localhost:8080
http://localhost
inAuthorized JavaScript origins
field too. -
Select
CREATE
button -
In the OAuth client created modal that appears, click
DOWNLOAD JSON
Configure to use the client id and secret in our app
Prerequisite: complete install of React app and server.
-
Download JSON from
google-auth-library
credential (which you downloaded from an earlier step, or from https://console.cloud.google.com/apis/credentials) toserver\config\oauth2.keys.json
-
Navigate to
server
andclient
directories, and copyexample.env
as.env
file in each case -
Extract from
oauth2.keys.json
REACT_APP_GOOGLE_CLIENT_ID
andREACT_APP_GOOGLE_CLIENT_SECRET
and save it toclient\.env