所以我正在尝试使用oauth authlogic插件(https://github.com/jrallison/authlogic_oauth)来处理我已经安装了常规authlogic的rails应用程序。我相信我已根据教程设置了所有内容,但我收到了这个错误:
401 Unauthorized
RAILS_ROOT: c:/goldhat_production
Application Trace | Framework Trace | Full Trace
c:/Ruby/lib/ruby/gems/1.8/gems/oauth-0.4.4/lib/oauth/consumer.rb:217:in `token_request'
c:/Ruby/lib/ruby/gems/1.8/gems/oauth-0.4.4/lib/oauth/consumer.rb:139:in `get_request_token'
c:/goldhat_production/vendor/plugins/authlogic_oauth/lib/authlogic_oauth/oauth_process.rb:21:in `redirect_to_oauth'
c:/goldhat_production/vendor/plugins/authlogic_oauth/lib/authlogic_oauth/oauth_process.rb:10:in `validate_by_oauth'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1098:in `valid_without_callbacks?'
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:315:in `valid?'
c:/goldhat_production/app/controllers/users_controller.rb:19:in `create'
我几乎迷失在这里......我做错了什么?如果需要任何额外的信息/代码供我参考,我将提供。
编辑:
我认为问题出在这里:我没有TOKEN或SECRET ......我从哪里得到这些?
def self.oauth_consumer
OAuth::Consumer.new("TOKEN", "SECRET",
{ :site=>"http://twitter.com",
:authorize_url => "http://twitter.com/oauth/authenticate" })
end
答案 0 :(得分:1)
您需要从Twitter开发页面获取令牌和秘密值,您需要注册您的应用程序才能获得这两个值,那么您应该很高兴。
这是指向正确推特页面的链接: http://dev.twitter.com/login?redirect_after_login=/apps/new