Omniauth Twitter回调后为空会话

| 我正在尝试构建一个使用OmniAuth gem的应用程序,以便Twitter用户可以登录。 我按照了教程中的步骤进行操作,我很确定自己做对了所有事情。 但是在Twitter的回调中,我得到了这个臭名昭著的错误消息:
NoMethodError
You have a nil object when you didn\'t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
在深入研究omniauth gem之后,我发现,在ѭ1中,会话不包含任何oauth信息
def callback_phase
    ::Rails.logger.info \"session: #{session.inspect}\"
    ::Rails.logger.info \"consumer: #{consumer.inspect}\"
    request_token = ::OAuth::RequestToken.new(consumer, session[\'oauth\'][name.to_s].delete(\'request_token\'), session[\'oauth\'][name.to_s].delete(\'request_secret\'))
    ...
end
回调后登录
session: {\"session_id\"=>\"190523311f7a63fe796558691b1d4fff\"}
consumer: #<OAuth::Consumer:0x103735b50 @secret=\"...\", @http=#<Net::HTTP api.twitter.com:443 open=false>, @key=\"...\", @options={:access_token_path=>\"/oauth/access_token\", :proxy=>nil, :http_method=>:post, :site=>\"https://api.twitter.com\", :request_token_path=>\"/oauth/request_token\", :scheme=>:header, :oauth_version=>\"1.0\", :signature_method=>\"HMAC-SHA1\", :authorize_path=>\"/oauth/authenticate\"}>
因此,从Twitter到omniauth的会话内容似乎没有被填充或丢失。 有谁知道,什么原因会导致这种行为? 我的Gemfile:
gem \'mongrel\', \'1.2.0.pre2\'
gem \"rails\", \"~> 3.0.6\"
gem \"mysql\"
gem \'omniauth\'
gem \'settingslogic\' # config/application.yml
gem \'will_paginate\', \'~> 3.0.beta\'
感谢您的帮助。     
已邀请:
在我的5英镑中,我有这样的事情:
# Be sure to restart your server when you modify this file.
PersonalAccount::Application.config.session_store :cookie_store, :key => \'_app_session\', :secure => true
但是在我的开发环境中,我没有使用SSL,因此OmniAuth无法存储其会话。 卸下ѭ7可以解决我的问题。     

要回复问题请先登录注册