As mentioned earlier, we use Passport to deal with user authentication in our API. Here, we will see how to use and store sessions and encrypt a user password to maintain a secure authentication.
First of all, let's install and save the Passport middleware to the application:
npm install passport passport-local --save
// Passport configuration require('./server/config/passport')(passport);
passport.jsfile and the necessary code inside the
configfolder. We can name this file with any name. However, to demonstrate the use of the
passportmodule, we use the same name from the module. Create ...