This code implements a Facebook authentication system using Node.js, Express, Passport.js and Mongoose.
- Node.js
- npm or yarn
- MongoDB instance
- Facebook App credentials
- git clone https://github.com/souravpl8092/QuestLabs-Assignment.git
- cd QuestLabs-Assignment
- npm install
- SESSION_SECRET = [ your session secret ]
- FACEBOOK_CLIENT_ID = [ your facebook app client ID ]
- FACEBOOK_SECRET_KEY = [ your facebook app secret key ]
- FACEBOOK_CALLBACK_URL = [ your facebook app callback URL ]
- mongoURL = [ your mongodb URL ]
- PORT = [ port number to run the server ]
- npm start
- This file connects to the MongoDB server using the mongoose library.
- This file defines a User schema using the mongoose.Schema method.
- This file defines a facebook-auth router using the express.Router method and implements the Facebook authentication strategy using the passport-facebook library.
- This file initializes the Express application, sets up the session middleware, passport.js authentication, and defines the routes for the Facebook authentication.