passport-facebook
passport-facebook copied to clipboard
Logout is not working
Below code is not logging out actually. still session is there. app.get('/logout',function(req,res){ req.logout(); res.redirect('/'); });
Hi,
req.logout() is not reliable, even though it's how documentation states. Please try that one in your handler:
req.session.destroy((err) => {
if(err) return next(err)
req.logout()
res.sendStatus(200)
})
Ran into same issue, the req.session.destroy
workaround noted above fixes it. thanks!
@bartekwitczak Thank you so much. Apparently that order is super important. I spent probably 4 hours trying to fix this issue until I found your solution.
FYI, I'm using create-react-app + node.js + express + passport.js
using passport-github, I have similar problem :
when the logout route is called, the client application is no more connected. But if I click on login, the application does not redirect me to the github authentication page, and my client is still connected.
Seems I am facing the same issue. Invoking the logout as mentioned in the documentation. But when attempting to login again with facebook it directly takes me in.
How to remove the facebook stored login session so that fresh login can be made?
Same problem with Facebook logout!