I have a very nasty problem with Node js, express 4 and passport. I have tried all the options that I can think of, but there is still no solution. Could not find a solution from other posts for this problem.
code:
app.post('/login', function(req, res, next) { console.log(req.body.user_email); console.log(req.body.user_password); passport.authenticate('local', function(err, user, info) { console.log(info); ...
The problem is that for some reason the passport does not receive credentials and says to console.log (info) "Missing credentials", although when the username and password are registered above, they are correct. The local strategy must also be properly configured:
passport.use(new LocalStrategy ({ usernameField: 'user_email', passwordField: 'user_password', }, function(username, password, done) { console.log(username); console.log(password); ...
The "function (username, password, done)" never starts because of the "Missing credentials".
The funny thing is that from another html / ejs page where a call is made for authentication:
app.post('/login_user', passport.authenticate('local', { successRedirect: '/loginSuccess', failureRedirect: '/loginFailure' }));
the problem does not exist.
Does anyone know what I don't see here?!?!
Thanks!