I currently have a mongoose/express/passportjs application that I can successfully log in and out with. However, only the user ID is stored in the session. I'd like the store the whole user object.
Here is the code I use:
passport.serializeUser(function(user, done) {
done(null, user._id);
});
passport.deserializeUser(function(_id, done) {
done(null, { _id: _id });
});
Works great, here is why I tried to serialize the entire user:
passport.serializeUser(function(user, done) {
done(null, user._id);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});
However, it doesn't store any session with that.
What am I doing wrong?