验证数据错误?

时间:2012-12-24 03:52:22

标签: ruby twitter

使用'twitter'宝石:

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和秘密。

1 个答案:

答案 0 :(得分: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/