I am trying to integrate passport to my code\'s login form. Client side calling server side works as it should until i call passport.authenticate in the request, 400 Bad Request
passport.use(new LocalStrategy(
{
usernameField: 'email',
passwordField: 'password'
},
function (email, password, done) {
db.collection('User').findOne({ email: email }, async function (err, user) {
console.log('user requested password caught in passport', password);
if (err) { return done(err); }
if (!user) { return done(null, false); }
const matchPassword = await comparePassword(password, user.password);
if (!matchPassword) { return done(null, false); }
return done(null, user);
});
}
));