Why is PassportJS in Node not removing session on logout

前端 未结 22 1826
有刺的猬
有刺的猬 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:01

    I faced the similar problem with Passport 0.3.2.

    When I use Custom Callback for the passport login and signup the problem persisted.

    The problem was solved by upgrading to Passport 0.4.0 and adding the lines

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

提交回复
热议问题