Open jainAdijain opened 7 years ago
Do u set the middleware called ‘initialize’ from passport?
yes
On Jun 15, 2017 13:28, "authhwang" notifications@github.com wrote:
Do u set the middleware called ‘initialize’ from passport?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaredhanson/passport-local/issues/154#issuecomment-308658182, or mute the thread https://github.com/notifications/unsubscribe-auth/AacC2tqgakskMDanfOu4vP28BBSYC1oNks5sEOQmgaJpZM4Ndi5C .
Use the below code as your session setup code //================== passport.serializeUser(function(user, done) { done(null, user.id); });
passport.deserializeUser(function(id, done) { User.findById(id, function(err, user) { done(err, user); }); });
@jainAdijain , Have you found the solution? I am facing the same issue.
passport.js
routes.js