Why is PassportJS in Node not removing session on logout

前端 未结 22 1844
有刺的猬
有刺的猬 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 23:06

    This worked for me:

    app.get('/user', restrictRoute, function (req, res) {
      res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate,
                  max-stale=0, post-check=0, pre-check=0');
    });
    

    It makes sure that your page won't get stored in cache

提交回复
热议问题