Passport.js failure message is not appearing Passport.js failure message is not appearing heroku heroku

Passport.js failure message is not appearing


Try this:

// Login Processrouter.post("/login", (req, res, next) => {  passport.authenticate("local", {    successRedirect: "/",    failureRedirect: "/auth/login",    failureFlash: true  })(req, res, next);});

Calling (req, res, next); is important otherwise the whole thing will just stuck there.


Maybe like this?

app.post('/login',  passport.authenticate('local', { successRedirect: '/home',                                   failureRedirect: '/login',                                   failureFlash: true }));