Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning off authenticity token in Rails 2 for web services?

Instead of just filling out the form in HTML it should also be possible to just send a post request containing the params.. Is it possible to turn off the authenticity token if, for example, the Accept flag is set to 'application/JSON' in the HTTP header?

like image 339
Nils Avatar asked Dec 08 '08 09:12

Nils


1 Answers

I know there is a way to turn it off for a controller or an action. Not sure about the content type. Wouldn't it be easier to just add the authenticity token to every json request? There are quite few articles around the web how to do it (for example here and here).

like image 116
Milan Novota Avatar answered Oct 28 '22 14:10

Milan Novota