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 PROJECTbutton, choose any name
Configure consent screen
-
Click
CONFIGURE CONSENT SCREENbutton or go to your OAuth Consent Screen https://console.cloud.google.com/apis/credentials/consent -
Select
Externaland clickCREATEbutton -
Fill in mandatory fields and click
SAVE AND CONTINUEbutton, and click that button again in theScopesscreen -
Add your account email as test user with
ADD USERSbutton, clickSAVE AND CONTINUEbutton
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 credentialsbutton and selectOAuth client ID -
In the Application type dropdown, select
Web applicationand 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:3000http://localhost:8080http://localhostinAuthorized JavaScript originsfield too. -
Select
CREATEbutton -
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-librarycredential (which you downloaded from an earlier step, or from https://console.cloud.google.com/apis/credentials) toserver\config\oauth2.keys.json -
Navigate to
serverandclientdirectories, and copyexample.envas.envfile in each case -
Extract from
oauth2.keys.jsonREACT_APP_GOOGLE_CLIENT_IDandREACT_APP_GOOGLE_CLIENT_SECRETand save it toclient\.env