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

Delete cookie on session destruction #143

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

iliakan
Copy link

@iliakan iliakan commented Sep 20, 2018

Right now when the session is destroyed, the session cookie is made empty, not removed.

That's an incorrect behavior, the cookie should be deleted as well. For that, we need to set the expiration date to the past, not just an empty value.

Right now when the session is destroyed, the session cookie is made empty, not removed.

That's an incorrect behavior, the cookie should be deleted as well. For that, we need to set the expiration date to the past, not just an empty value.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 00e9ec0 on iliakan:patch-1 into 4ea5a63 on koajs:master.

@dead-horse
Copy link
Member

looks like browser will delete the cookie when received empty string as a cookie value ( works with chrome and safari)

@iliakan
Copy link
Author

iliakan commented Oct 8, 2018

For me it affected autotests that failed when I switched from another session module.

@@ -272,7 +272,7 @@ class ContextSession {
const externalKey = this.externalKey;

if (externalKey) await this.store.destroy(externalKey);
ctx.cookies.set(key, '', opts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should keep other options so we will delete ${key}.sig also.

@ejose19
Copy link

ejose19 commented Aug 16, 2019

@dead-horse Any updates on when this fix will be merged?

@jmitchell38488
Copy link
Contributor

jmitchell38488 commented Aug 16, 2019

@ejose19 @dead-horse I've created a pull request with code to expire the .sig and session cookies #180

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

Successfully merging this pull request may close these issues.

5 participants