Express Passport.js Success redirect doesn't load page, request keeps pending
I found an answer to my question, the problem was that the User model was not defined in the script where serializeUser and deserializeUser were defined.I could not figure out what was going on, because I did not define any action in catch all handler, so a thing to remember, make sure to have catch all handler defined to know what is happening
app.use(function(err, req, res, next) { console.log(err);});
I was facing the same problem as your a few days back and what I found was that I forgot to put parenthesis at the end of the serializeUser
and deserializeUser
functions.I was actually using the passport-local-mongoose
package for the respective functions. But it must be noted that in app.use()
the functions are called and executed for all the template files so, we do use parenthesis with the names of the functions.