簡體   English   中英

使用 authlogic oauth 時出現 401 錯誤

[英]401 error when using authlogic oauth

所以我試圖讓 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'

我在這里幾乎迷路了......我做錯了什么? 如果需要任何其他信息/代碼以供參考,我會提供。

編輯:

我在想問題出在這里:我沒有令牌或秘密......我從哪里得到這些?

 def self.oauth_consumer
      OAuth::Consumer.new("TOKEN", "SECRET",
      { :site=>"http://twitter.com",
        :authorize_url => "http://twitter.com/oauth/authenticate" })
  end

您需要從 twitter 開發頁面獲取令牌和秘密值,您需要注冊您的應用程序以獲取這兩個值,那么您應該對 go 很好。

這是正確 twitter 頁面的鏈接: http://dev.twitter.com/login?redirect_after_login=/apps/new

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM