Answer the question
In order to leave comments, you need to log in
How to delete a session from the database?
I use connect-session-sequelize to authorize the user, but the session is not deleted after /logout, the page is updated and the passport considers the user authorized. I'm thinking of adding a user id to the table, and then searching for and deleting the session from the database.
1) Is it right to do this?
2) Maybe I did something wrong, what else could be the problem? Here is the code:
app.get('/logout', function(req, res) {
console.log('logout', req.session); // cookie { passport: {...}}
req.logout(); // cookie { no_passport}
req.session.destroy(); // не удаляет
res.redirect('/');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question