rails - InvalidAuthenticityToken for json/xml requests

后端 未结 6 1303
清歌不尽
清歌不尽 2020-12-15 05:08

For some reason I\'m getting an InvalidAuthenticityToken when making post requests to my application when using json or xml. My understanding is that rails should require an

6条回答
  •  天命终不由人
    2020-12-15 05:27

    To add to Fernando's answer, if your controller responds to both json and html, you can use:

          skip_before_filter :verify_authenticity_token, if: :json_request?
    

提交回复
热议问题