Passport.js - Error: failed to serialize user into session
If you decide not to use sessions, you could set the session to false
app.post('/login', passport.authenticate('local', {
successRedirect: '/accessed',
failureRedirect: '/access',
session: false
}));
It looks like you didn't implement passport.serializeUser
and passport.deserializeUser
. Try adding this:
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});