0

I'm using devise + omniauth and I can connect to twitter api correctly.

But when I try to use twitter gem, I have the following error in console :

"Twitter::Error::Forbidden - Unable to verify your credentials"

I have installed the gem and created an initializer at config/initializers/twitter.rb

Twitter.configure do |config|
    config.consumer_key = PKe41...
    config.consumer_secret = qETY.....
end

And I'm trying into a controller :

def twitter
    @twitter_home_timeline = Twitter.home_timeline
end

2 Answers 2

3

Ok, I found the answer... Keys in the initializer must be set with quotation marks :

Twitter.configure do |config|
    config.consumer_key = 'PKe41...'
    config.consumer_secret = 'qETY.....'
end
2

You also need to add oauth token and secret If you don't, you just give two credentials of an account. It can't find the correct app used for these credentials.

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
1
  • 1
    it works without oauth token and secret - that implies less access to user's data.thanks anyway ! Jul 18, 2013 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.