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

CSRF prevention tokens in cookies #18

Open
dan-corneanu opened this issue Jun 19, 2015 · 1 comment
Open

CSRF prevention tokens in cookies #18

dan-corneanu opened this issue Jun 19, 2015 · 1 comment
Labels

Comments

@dan-corneanu
Copy link

Hi,
my grape APIs are protected against CSRF through a X-CSRF-Token request header. The value that has to go into this header is sent by the server to clients through a cookie.

Is there a way to customise grape-swagger-rails to add this header to every request?
Ex.

xhr.setRequestHeader('X-CSRF-Token', $.cookie('CSRF-Token'))
@dblock
Copy link
Member

dblock commented Jun 19, 2015

I think this will need a bit of work, see how things are added to the request here: https://github.com/TinkerDev/grape-swagger-rails/blob/master/app/views/grape_swagger_rails/application/index.html.erb#L49.

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

No branches or pull requests

2 participants