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
- Clone / download the repository in the local file system
- Open Terminal and traverse in the directory where repository is placed using "cd " command
- Place your AppId and Secreat Key in ".env.txt" file and save that file as ".env" in same directory.
- run npm install (This will generate all the dependencies/packages required to run this software)
- Then execute npm run start command (This will run the application in debug mode)
Routes Information
-
User Routes
- /user/ - To handle the basic user page
-
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