Why is PassportJS in Node not removing session on logout

前端 未结 22 1822
有刺的猬
有刺的猬 2020-11-28 22:11

I am having trouble getting my system to log out with PassportJS. It seems the logout route is being called, but its not removing the session. I want it to return 401, if th

22条回答
  •  执笔经年
    2020-11-28 22:45

    I used both req.logout() and req.session.destroy() and works fine.

    server.get('/logout', (req, res) => {
      req.logout();
      req.session.destroy();
      res.redirect('/');
    });
    

    Just to mention, i use Redis as session store.

提交回复
热议问题