2012-12-24 115 views
1

使用 '推特' 創業板:錯誤的身份驗證數據?

Twitter.configure do |config| 
    config.consumer_key = ENV['TWITTER_KEY'], 
    config.consumer_secret = ENV['TWITTER_SECRET'] 
end 

twitter = Twitter::Client.new(
    oauth_token: current_user.twitter_token, 
    oauth_token_secret: current_user.twitter_secret 
) 

,並得到一個

Twitter::Error::Unauthorized: Could not authenticate you 

試圖調用

twitter.user_timeline('saiko_chriskun') 

,因爲他們通過omniauth確定,我跑的關鍵應該是罰款時,能夠獲取用戶的oauth_token和祕密。

回答

0

請看到這一點:

Twitter.configure do |config| 
    config.consumer_key = YOUR_CONSUMER_KEY 
    config.consumer_secret = YOUR_CONSUMER_SECRET 
    config.oauth_token = YOUR_OAUTH_TOKEN 
    config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET 
end 

http://sferik.github.com/twitter/