我想獲取訪問密鑰,但我無法使它工作。 ``request_token.get_access_token is giving me
401未經授權(OAuth的::未授權)error. I copy the authorize_url into my browser, allow the application, I receive some kind of PIN from twitter but after hitting enter in my script I always get 401 error. I did some search and I found this helped
=的access_token request_token.get_access_token(:oauth_verifier => PARAMS [:oauth_verifier])but it is giving me
未定義局部變量或方法params' for main:Object (NameError)
OAuth給我401錯誤
- twitter的應用程序類型是客戶端
- 紅寶石腳本就像(我在下面this tutorial)
- 我很想擺脫這種腳本訪問細節。最好不使用PIN。
。
gem 'oauth'
require 'oauth/consumer'
consumer_key = 'your key'
consumer_secret ='your secret'
consumer=OAuth::Consumer.new "consumer_key",
"consumer_secret",
{:site=>"http://twitter.com"}
request_token = consumer.get_request_token
puts request_token.token
puts request_token.secret
puts request_token.authorize_url
puts "Hit enter when you have completed authorization."
STDIN.gets
access_token = request_token.get_access_token
#access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
puts access_token.token
puts access_token.secret
puts
puts access_token.inspect
未定義的局部變量或方法'的OAuth」主:對象(NameError)' – Radek 2010-04-10 12:52:25
那是我在發佈第一個例子中的錯誤。我已經寫了我的答案,這使得previuos評論無關緊要。 當前答案應該修復原始問題 – Morgan 2010-04-10 14:53:17
太棒了!很好地工作。我可以做一次獲取祕密訪問細節的程序,稍後再使用。 – Radek 2010-04-11 00:58:18