Created
January 5, 2015 18:07
-
-
Save he-and-her/1f5c2d30eda01ac20bb6 to your computer and use it in GitHub Desktop.
Rails 4 solution for "Can't verify CSRF token authenticity” json requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :null_session, | |
if: Proc.new { |c| c.request.format =~ %r{application/json} } | |
end |
i was struggling this error "Can't verify CSRF token authenticity" since long time. Thank you so much for this solution.
Thanks for this solution though it has been 8 years already, this helped me finish off my tinkering task (I'm not a backend guy nor a RoR guy.). I am currently using Rails 7.0.3.1. The rails app connected to Braintree was throwing me this error:
Can't verify CSRF token authenticity
- this gist is the answer.
nice to read!
i was struggling this error "Can't verify CSRF token authenticity" since long time. Thank you so much for this solution.
awesome!
i am having a similar issue with google signin any help
Is this safe?
I was wondering the same.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this solution though it has been 8 years already, this helped me finish off my tinkering task (I'm not a backend guy nor a RoR guy.).
I am currently using Rails 7.0.3.1.
The rails app connected to Braintree was throwing me this error:
Can't verify CSRF token authenticity
- this gist is the answer.