This is the server part of the sing in with Google and Github example.
Create a Google client ID and client secret:
- Go to Google Developer Console
- Click
Create a new project
or select an existing project. - Click
CONFIGURE CONSENT SCREEN
. - Select
External
from User Type. - Fill App information and Developer contact information fields:
- Fill
App name
(App information) - Select
User support
email (App information) - Fill
Email address
(Developer contact information)
- Fill
- Click
SAVE AND CONTINUE
. - Click
SAVE AND CONTINUE
inScopes
section. - Click
ADD USERS
button fromTest users
section and add the user email. - CLick
SAVE AND CONTINUE
. - In the sidebar under
APIs & Services
, selectCredentials
. - Select the
Create credentials
drop-down list, and chooseOAuth client ID
. - Under
Application type
, selectWeb application
. - In
Authorized redirect URI
usehttp://localhost:5005/auth/google/callback
. - Click the
Create
button and copy the generatedclient ID
toGOOGLE_CLIENT_ID
andclient secret
toGOOGLE_CLIENT_SECRET
environment variables.
Create a Github client ID and client secret:
- Go to Github Developer Settings
- Click on
Register a new application
button. - Fill
OAuth application
information:- Fill
Application name
- Fill
Homepage URL
- Fill
Authorization callback URL
withhttp://localhost:5005/auth/github/callback
- Fill
- Click
Register application
button. - Copy the generated
client ID
toGITHUB_CLIENT_ID
environment variable and click onGenerate a new client secret
button for generating client secret, then copy the generatedclient secret
toGITHUB_CLIENT_SECRET
environment variable.
Get the directory cd server
and install the dependencies:
npm install
Compile the server:
npm run compile
Start the server:
npm start