rails - “WARNING: Can't verify CSRF token authenticity” for json devise requests

前端 未结 10 2166
终归单人心
终归单人心 2020-11-27 10:11

How can I retrieve the CSRF token to pass with a JSON request?

I know that for security reasons Rails is checking the CSRF token on all the request types (including

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 10:37

    What's worrying is that in Rails 3.2.3 we now get the CSRF warning in production.log but the post does not fail! I want it to fail as it protects me from attacks. And you can add the csrf token with jquery before filter btw:

    http://jasoncodes.com/posts/rails-csrf-vulnerability

提交回复
热议问题