OmniAuth 1.0:单击 user_omniauth_authorize_path(:facebook) 链接时出现 NoMethodError
单击 user_omniauth_authorize_path(:facebook) 链接时遇到此问题:
Started GET "/users/auth/facebook" for 127.0.0.1 at 2012-02-24 10:57:03 +0200
NoMethodError (undefined method `include?' for nil:NilClass):
omniauth (1.0.2) lib/omniauth/strategy.rb:165:in `call!'
omniauth (1.0.2) lib/omniauth/strategy.rb:148:in `call'
omniauth (1.0.2) lib/omniauth/builder.rb:42:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__2667807547873405266__call__33580566203138325__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
我目前正在尝试迁移到将 OmniAuth 1.0 与omniauth-facebook gem 一起使用。所有这些东西都在 Rails 3.2.1 上运行。我正在关注这里的教程: https://github.com/plataformatec/devise/wiki /OmniAuth:-概述
现在我找不到任何与该教程中所做的不同的事情。当我点击页面上的 Facebook 登录按钮时,我仍然遇到了这个问题。
深入研究omniauth gem的strategy.rb,它在这一点上失败了:
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
I'm having this problem when clicking on user_omniauth_authorize_path(:facebook) link:
Started GET "/users/auth/facebook" for 127.0.0.1 at 2012-02-24 10:57:03 +0200
NoMethodError (undefined method `include?' for nil:NilClass):
omniauth (1.0.2) lib/omniauth/strategy.rb:165:in `call!'
omniauth (1.0.2) lib/omniauth/strategy.rb:148:in `call'
omniauth (1.0.2) lib/omniauth/builder.rb:42:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__2667807547873405266__call__33580566203138325__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
I'm currently trying to migrate to use OmniAuth 1.0 with omniauth-facebook gem. All this stuff is running with Rails 3.2.1. I was following the tutorial here: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
Right now I can't find anything that I did differently than in that tutorial. Still I'm getting this problem when clicking on the Facebook login button on my page.
Digging into a strategy.rb of the omniauth gem, it fails at this point:
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚将其添加到初始化文件中,它似乎解决了问题。
I just added this to an initialization file and it seems to fix the issue.
据我发现,该错误不在omniauth gem 中,而是在rack 中。至少 github 上的人是这么发现的。检查问题:
OmniAuth:https://github.com/intridea/omniauth/issues/568
和
机架:https://github.com/rack/rack/issues/322
当我从 gems 切换到查看存储库时,它开始工作:
From what I have found, the bug is not within the omniauth gem, but in rack. At least that's what the guys over at github have found. Check the issues:
OmniAuth: https://github.com/intridea/omniauth/issues/568
and
Rack: https://github.com/rack/rack/issues/322
I got it working when I switched from the gems to checking out the repos: