Sunday, 4 June 2017

Passport Node(Error: Failed to deserialize user out of session.)

I'm using Node.js, express, passport and MySQL.

Here is my deserialize code:

passport.deserializeUser(function(id, done) {
connection.query("select * from users where UserId = "+id,function(err,rows){  
        console.log(rows); 
        done(err, rows[0]);
    });
});

Also, checked using console.log that "rows" is returning the row of the required user.

app.get('/logout', function(req, res){
  req.logout();
  res.redirect('/');
});



via Ishaan Shakunt

No comments:

Post a Comment