我有两个应用程序需要通过HTTP相互通信。一个是PHP应用程序,另一个是我的主应用程序,Rails应用程序。我需要PHP应用程序通过POSTing数据与Rails应用程序通信,但当我这样做时,我收到无效的身份验证令牌错误。有没有什么办法解决这个问题呢?或者,我如何创建自己的令牌来传递帖子,以便我的Rails应用程序进行身份验证?
发布于 2010-09-10 22:26:25
从documentation for ActionController::RequestForgeryProtection::ClassMethods
您可以通过指定and :except或从文档中强制将before筛选器设为skipped....Example来跳过身份验证令牌要求...
class FooController < ApplicationController
protect_from_forgery :except => :index
# you can disable csrf protection on controller-by-controller basis:
skip_before_filter :verify_authenticity_token
endhttps://stackoverflow.com/questions/3685316
复制相似问题