Passport-Local Mongoose is a Mongoose plugin that simplifies username creation and password login with Passport.
This module auto-generates salt and hash fields, you don’t require to hash the password with this crypto module, the passport-local-mongoose does this for you.Whenever a user simply hashes their password and if there are two users in the database that have the same password, they will end up having the same hash.
Now, if any one of these passwords gets hacked then the hacker can reach each account that uses the same password because users with identical passwords have the same hash fields.Here are few steps, you can follow for authentication:Create a Directory StructureCreate a Model/User.js File Configuring Passport/Passport-Local in App.jsCreation of the Route/User.js FileRead more here - Nodejs Authentication With Passport JS and Passport Local Mongoose