I am right now developing web APIs with Ruby on Rails. When the Rails app receives POST request without any csrf token, the following error message shall happen. Because the app has no views.
WARNING: Can't verify CSRF token authenticity
So my question is how can I escape csrf token check safely in this case?
Thank you very much in advance.
For rails 4 it should be
Note that you should avoid skipping verify_authenticity_token on all actions of your controller, instead use the option
only
to skip only where you have to. See the docsYou can do this by adding
to your controller. This way all incoming requests to the controller skips the :verify_authenticity_token filter.