jwt-csrf icon indicating copy to clipboard operation
jwt-csrf copied to clipboard

Support Submit/Authed Submit driver for full page reload

Open bjrmatos opened this issue 9 years ago • 3 comments

I think the main idea to use JWT for stateless verification is great, however it would be nice to support apps with full page reloads.

i think that using only the cookie persistence (without header persistence), generating the token, adding it in my view (maybe in hidden field) and with a middleware that verify the jwt in the cookie against a field in the req object would make it work. Any toughts?

bjrmatos avatar Jun 03 '16 08:06 bjrmatos

Hmm... I think you're right. Passing back the token as a header makes sense w/ AJAX, but not really anything else. The double submit pattern is pretty nice though... but as it stands, it only works with cookies and headers. Not sure I want to add yet another CSRF driver, but maybe we could add another "persistence method" (Ex: "form" or "body") that parses out body params, then we can just require users to drop a hidden form param named x-csrf-jwt.

mstuart avatar Jun 08 '16 04:06 mstuart

Thanks for bringing this up @bjrmatos! I'll tag this issue as a feature request and keep this open for contributions (if nobody wants to contribute, I might be able to find some time soon).

mstuart avatar Jun 08 '16 04:06 mstuart

@mstuart thnk you! my main intention is to be able to use a single package based on JWT for the CRSF problem no matter if it is a SPA or a web app with full reloads.

maybe i can find some time and take care of this 👍

bjrmatos avatar Jun 08 '16 04:06 bjrmatos