Nothing Special   »   [go: up one dir, main page]

Skip to content

Demo code for Medium.com article Protect REST API after social login with Node.js and Express.js

Notifications You must be signed in to change notification settings

Spyna/protect-rest-api-after-social-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protect-rest-api-after-social-login

Demo code for Protect REST API after social login with Node.js and Express.js alt text .

Runnin Demo

https://authenticated-social-login.herokuapp.com/ be patient, the app is hosted on Heroku, and they turn off/on the instance after 30 minutes of inactivity. So, when you access after that time, the node process needs to start.

Disclaimer

This code is not optimized to run in production. It is just a demo application to show the flow and the features described in the article.

run locally

Clone the repo

git clone https://github.com/Spyna/protect-rest-api-after-social-login.git && cd protect-rest-api-after-social-login
yarn install;

Configure the project

edit the .env file in the root of the project. If you leave it as is, the application will work only with google, but not with facebook, because you need to set a proper client_secret in order to use facebook.

FACEBOOK_CLIENT_ID = 345722605906305
FACEBOOK_CLIENT_SECRET = **********

GOOGLE_CLIENT_ID = 796039115979-rsimds98j3ii2pa27qm3svj7pa6eb5i5.apps.googleusercontent.com

JWT_SECRET_PASSWORD = secretPassToEncodeJWTs

Launch the application with the local script.

npm install -g nodemon
yarn local
#npm run local

Open the browser at http://localhost:5000

About

Demo code for Medium.com article Protect REST API after social login with Node.js and Express.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published