Rails facebook app返回422"你想要的改变被拒绝"错误

Jay*_*ayX 3 facebook ruby-on-rails omniauth

我的脸书今天刚刚获得批准.然而,当我点击"转到应用程序"时,它返回Rail 422"您想要的更改被拒绝.错误"我将我的Canvas URL设置为我的网站URL并且我正在使用Omniauth,所以我只是想知道我错过了什么.

azo*_*tov 11

尝试删除

protect_from_forgery
Run Code Online (Sandbox Code Playgroud)

在application_controller中,或

# you can disable csrf protection on controller-by-controller basis:
skip_before_filter :verify_authenticity_token
Run Code Online (Sandbox Code Playgroud)

Facebook使用signed_request,您可以解码并使用它来验证请求实际来自Facebook,因此对于只能通过Facebook画布访问的应用程序,不需要protect_from_forgery.

更多信息:Canvas Authentication&ActionController :: RequestForgeryProtection