Riyad Anabtawi
Riyad Anabtawi

Reputation: 47

Unable to verify your credentials Twitter Error Ruby on Rails

Im integrating Twitter in my Ruby on Rails App.

im using gem 'twitter'

and i want to fetch my followers count

client = Twitter::REST::Client.new


@talking_about_count = graph.get_object("iscopeapp")["talking_about_count"]

@followers = client.followers("AnabtaTec")

The Thing is when i access the page this error apears.

Twitter::Error::Forbidden in HomeController#index

Unable to verify your credentials

I guess im missing some tokens or something. Could anyone help or guide me to get these tokens and then how to implement them in my controller?

Thanks in Advance guys!

cheers

Upvotes: 0

Views: 2734

Answers (1)

emcanes
emcanes

Reputation: 1398

Yes you are missing your credentials.

client = Twitter::REST::Client.new do |config|
  config.consumer_key        = "YOUR_CONSUMER_KEY"
  config.consumer_secret     = "YOUR_CONSUMER_SECRET"
  config.access_token        = "YOUR_ACCESS_TOKEN"
  config.access_token_secret = "YOUR_ACCESS_SECRET"
end

You can get the keys from https://dev.twitter.com/ and setting up your app. If you are pulling in the count for different users, then you would setup something like devise with omniauth and store the key off in the table for each user.

Upvotes: 0

Related Questions