I am new to Passport and I send email and password as {"email":"[email protected]","password":"xxx"} as request body to the server.On server side,I make use of passportJS as in https://github.com/jaredhanson/passport-local#available-options like,
passport.use(new LocalStrategy(
{usernameField: 'email',
passwordField: 'password',
passReqToCallback: true
},
function(req,username,password,done){
console.log("am here");
var x=req.body;
var email=x.email;
var password=x.password;
console.log(x.email);
}
))
app.post('/loginUser',passport.authenticate('local'),function(req,res){
var x=req.body;
db.users.findOne({"email":x.email,"password":x.password},function(err,user){
res.json(user)
})
});
The Local Strategy isn't getting accessed.The application crashes and I only get TypeError: LocalStrategy requires a verify callback. Please let me know where i went wrong