Skip to content

This is the basic facebook authentication tutorial built in node.js and passport.js and it uses the facbook's OAuth service to authenticate the user, and can be used to provide the "login with facebook" functionality to the user.

Notifications You must be signed in to change notification settings

pranilism/Facebook-Auth-Using-Node-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facebook Authentication using Node.js

This is the basic authentication software which demonstrates the OAuth Authentication using the facebook's OAuth service. This is the web api application used to authenticate the user by sending the request from the client side. This software uses the lates version of node.js and passport.js is used for the facebook authentication.

You will require :

  • node.js (Latest Version), you can download it from here
  • Already existing facebook id and secreat key, if not you can register your app and generate it from here

Steps to run the software on your local machine

  1. Clone / download the repository in the local file system
  2. Open Terminal and traverse in the directory where repository is placed using "cd " command
  3. Place your AppId and Secreat Key in ".env.txt" file and save that file as ".env" in same directory.
  4. run npm install (This will generate all the dependencies/packages required to run this software)
  5. Then execute npm run start command (This will run the application in debug mode)

Routes Information

  1. User Routes
    • /user/ - To handle the basic user page
  2. Auth Routes
    • /auth/ - To handle the basic auth info page
    • /auth/facebook - To verify the user by facebook OAuth system
    • /auth/success - To handle the success callback from facebook OAuth system
    • /auth/done - To verify the user is already logged in and if he is logged in then will be redirected on this route by facebook OAuth system
    • /auth/fail - If the varification is failed then will be redirected on this route by facebook OAuth system

Folder Structure

  • node_modules
  • routes
    • auth.js
    • user.js
  • utils
    • passport.middlewares.js
  • app.js
  • server.js
  • package-lock.json
  • package.json
  • .env
  • README.md
  • .gitignore

© Developed by Pranil Tunga

About

This is the basic facebook authentication tutorial built in node.js and passport.js and it uses the facbook's OAuth service to authenticate the user, and can be used to provide the "login with facebook" functionality to the user.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published