Devise + Omniauth [警告:无法验证CSRF令牌真实性]

sur*_*uen 6 ruby-on-rails csrf devise omniauth

我收到了这个警告

WARNING: Can't verify CSRF token authenticity
Run Code Online (Sandbox Code Playgroud)

在我的回调动作运行之前,即

Started GET "/users/auth/open_id?openid_url=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid" for 98.xxx.xx.xx at 2011-09-12 16:26:02 -0400
Started GET "/users/auth/open_id/callback?openid_url=https%3A%2%2Fwww.google.com%2Faccounts ... etc ... etc
Processing by Users::OmniauthCallbacksController#open_id as HTML
Parameters: {"openid_url"=>"https://www.google.com/accounts/o8/id"}
WARNING: Can't verify CSRF token authenticity
Entering Users::OmniauthCallbacksController, omniauth_login
Run Code Online (Sandbox Code Playgroud)

直接来自浏览器的请求没有警告.我使用rails 3.1,设计1.4.5,omniauth 0.2.6.

关于如何解决这个问题的想法?

谢谢!

Rob*_*ead -4

关闭protect_from_forgery对我有用。

  • 你可以说得更详细点吗?在哪里/如何关闭它?仅适用于 openid 身份验证?否则听起来可能会导致潜在的安全漏洞...... (3认同)
  • 只有当您**知道**自己在做什么时才应该这样做。如果你要根据 StackOverflow 的答案关闭“protect_from_forgery”,那么你**不知道**你在做什么! (2认同)