Skip to content

Reset csrf meta tag based on presence of headers#200

Open
joefiorini wants to merge 1 commit intoDavyJonesLocker:masterfrom
joefiorini:master
Open

Reset csrf meta tag based on presence of headers#200
joefiorini wants to merge 1 commit intoDavyJonesLocker:masterfrom
joefiorini:master

Conversation

@joefiorini
Copy link
Contributor

We're setting up authentication with devise and trying to just use the default session cookies. The only problem, as you probably already know, was resetting the CSRF token after sign-in/sign-out. Since we're already grabbing the token from the meta to send it up to the server, what do you think about adding the following to the csrf.js initializer template in the initializer?

This approach is based on the following stack overflow post:

http://stackoverflow.com/questions/20875591/actioncontrollerinvalidauthenticitytoken-in-registrationscontrollercreate

We're setting these headers in an after filter on a custom SessionsController that inherits from Devise::SessionsController. It would still be on the developer to send those tokens back in a header somewhere, but I think that's reasonable.

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.

1 participant