我正在研究从Facebook上获取详细信息的Rails应用程序。我已经从facebook获取了细节。但是,当我刷新网页时,发现了一个名为CSRF的错误。我使用了一些方法,但是所有方法都失败了。
facebook Graph API用于编辑操作。
这些已添加到Employees Controller的内部类中。
skip_before_action :verify_authenticity_token
skip_before_action :verify_authenticity_token, only: [:edit]
protect_from_forgery :only => [:edit]
skip_before_action :authenticate_user, only: [:edit]
skip_before_action :authenticate_user!
使用authenticate_user(第4和第5种情况)时,出现参数错误Before process_action callback :authenticate_user has not been defined
。
在所有其他情况下,使用Facebook更新页面后刷新页面时的错误是 OmniAuth::Strategies::OAuth2::CallbackError
csrf_detected | CSRF detected
PS:我已经使用“ omniauth-facebook”和“ koala” gem进行了集成。
我之前有这个问题,我早些时候尝试过验证真实性令牌,但是它仅在重定向页面时才起作用,因此我要求您仅重定向页面。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句