Why is PassportJS in Node not removing session on logout

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

    None of the answers worked for me so I will share mine

    app.use(session({
        secret: 'some_secret',
        resave: false,
        saveUninitialized: false,
       cookie: {maxAge: 1000} // this is the key
    }))
    

    and

    router.get('/logout', (req, res, next) => {
        req.logOut()
        req.redirect('/')
    })
    

提交回复
热议问题