Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expressjs passport-local can't logout

I copy pasted the app passport-local on my app,

The fun is I can log in users, but I can't make them logout,

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

this is not doing nothing, nothing on the logfiles, and I I have its a link to /logout

this is the main route examples

app.get('/page1', function(req, res){                                                                                                                       
  res.render('page1', {user: req.user});
});

app.get('*', function(req,res){
  res.render('root', {user: req.user});
});

Why the logout its not working ????

like image 921
Nonyck Avatar asked Nov 12 '22 22:11

Nonyck


1 Answers

Apparently this is a known problem:

Why is PassportJS in Node not removing session on logout

The thread mentioned above suggests to use req.session.destroy() instead.

It would be nice to have some feedback from the Passport team directly.

like image 176
Pensierinmusica Avatar answered Nov 15 '22 12:11

Pensierinmusica