Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

cookie option issues #14

Open
jonathanong opened this issue May 28, 2014 · 2 comments
Open

cookie option issues #14

jonathanong opened this issue May 28, 2014 · 2 comments
Assignees
Milestone

Comments

@jonathanong
Copy link
Member

https://github.com/expressjs/csurf/blob/master/index.js#L44 cookieKey should be _csrfSecret or something not _csrf. i think that confuses people.

also, i think we should move this lib to cookies because implicitly depending on another middleware is silly. this way we could optionally pass in other options like .httpOnly and maxAge, etc.

@defunctzombie
Copy link

I was caught by this issue. the _csrf field is actually the _csrf secret and not the csrf token which the user must set into a cookie on their own.

@dougwilson dougwilson added this to the 2.0.0 milestone Nov 9, 2014
@dougwilson dougwilson modified the milestone: 2.0.0 Feb 15, 2015
@dougwilson dougwilson self-assigned this Feb 15, 2015
@mrm-dev1
Copy link

mrm-dev1 commented Mar 7, 2017

after smashing my head on my desk here pretty much all day because i could not create a simple post due the invalid token error (which in fact was valid the whole time i did notice the cookie being out of sync).

i realized that the cookie was interfering with your nicely documented manual "Simple express example" what worked for me was to disable cookies entirely "var csrfProtection = csurf({ cookie: false });" and other than the csurf being miss-spelled csrf also i had to post the token to "X-CSRF-Token" headers.

i think you tried to mention this here #52 and it did help me target the issue by disabling the cookie altogether but passing the tokens through the headers as well seemed like an extra step no?

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

No branches or pull requests

5 participants