PassportJS is a flexible Authentication middleware that allows users to login. PassportJS library is fully customizable and works well with ExpressJS.
It is flexible in the sense that it allows the user for different login strategies such as LocalStrategy (Authentication from your local database), FacebookStrategy, TwitterStrategy, GIT etc.
Please checks the strategies that you can use in passport are as follows:-
Importing the module and using it passport.initialize() and passport.session() Configuring it for atleast one Authentication strategy and setting serializeUser() and deserializeUser() methods. Define a route for actually authenticating the user using passport.authenticate.
- req.login()
- req.logout()
- req.isAuthenticated()
- req.isUnAuthenticated()
node app or npm start
npm install