question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clearing session does not remove cookies

See original GitHub issue

Seems like I’m experiencing a similar issue to this one: https://github.com/expressjs/cookie-session/issues/100

When setting req.session = null the cookie does not get removed.

There is actually a test that explicitly checks the cookie is still available:

https://github.com/expressjs/cookie-session/blob/master/test/test.js#L350

It seems like the cookie should get cleared when the session is. Unfortunately I cannot see a way to reliably clear the cookie in the Cookie module either.

Should it be doing something like this?

https://github.com/expressjs/cookie-session/compare/master...PaulCampbell:clear-cookies

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, May 20, 2020

Haha, no problem. I do read them all, even if I don’t have a chance to respond 👍 . I love to help out, though responses, code, or docs! I’ll get the docs improved up around how, specifically, the cookie is managed, as I think there have been a few questions around it.

1reaction
dougwilsoncommented, May 20, 2020

This module never clears the cookie, only clears the data from the session when setting to null – the cookie will stay around to keep subsequent requests from constantly trying to reset the cookie again and ready to put more data in the session.

This module doesn’t say that setting it to null will actually clear the cookie, but to be fair, it also doesn’t describe what it does, specifically. The docs can be improved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does Session.Abandon delete the Cookie? - MSDN - Microsoft
The quick answer is: "No, it does not delete the sessionID cookie". ... budugu had a neat suggestion to do this: Session.Abandon(); Response.Cookies.Add(new ......
Read more >
Not deleting session cookies.. Is it safe?
Session cookies in Chrome are referred to as "Local Data": Settings -> Content settings. If clicking "Allow local data to be set (Recommended)" ......
Read more >
Chrome deletes cookies and sessions but it shouldn't
Chrome deletes cookies and sessions but it shouldn't - Super User. Stack Overflow for Teams – Start collaborating and sharing organizational ...
Read more >
`req.session.destroy()` does not remove cookies with the latest ...
Hi, I have come across a very annoying bug recently. If you upgrade nextjs to the latest version, which is 10.0.3, and deploy...
Read more >
Clear, enable, and manage cookies in Chrome - Google Support
Clear all cookies · On your computer, open Chrome Chrome . · At the top right, click More More and then Settings Settings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found