Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout is not working #202

Open
DIneshArun1991 opened this issue Apr 20, 2017 · 6 comments
Open

Logout is not working #202

DIneshArun1991 opened this issue Apr 20, 2017 · 6 comments

Comments

@DIneshArun1991
Copy link

Below code is not logging out actually. still session is there.
app.get('/logout',function(req,res){
req.logout();
res.redirect('/');
});

@bartekwitczak
Copy link

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)
})

@pszabop
Copy link

pszabop commented May 24, 2017

Ran into same issue, the req.session.destroy workaround noted above fixes it. thanks!

@obo20
Copy link

obo20 commented Aug 23, 2018

@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

@yo34
Copy link

yo34 commented May 30, 2019

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.

@mauryakrishna
Copy link

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?

@chriisduran
Copy link

Same problem with Facebook logout!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants