Passport Expressjs-local cannot exit

I will copy the application passport to the local application,

Interestingly, I can register users, but I can’t get them to log out,

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

it does nothing, nothing happens on the log files, and I have a link to / logout

These are the main examples of routes.

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

Why does logout not work?

+4
source share
1 answer

This seems to be a known issue:

Why PassportJS in Node Does Not Delete a Session on Logout

The above thread suggests using req.session.destroy() .

It would be nice to get feedback from the Passport team.

+2
source

Source: https://habr.com/ru/post/1434808/


All Articles