0

I'm using Omniauth to get credentials from Twitter for a specific User. Part of the OmniAuth object that I get is like this:

credentials=#
<Hashie::Mash secret="XXXX" token="XXXX">
extra=#<Hashie::Mash access_token=#<OAuth::AccessToken:xxxx @token="xxxx", @secret="xxxxx", ..

Right now I'm storing the credentials[token] and the UID for that specific User. At some point I want to fetch the Twitter API using the auth for that specific User to avoid getting the 150 max requests for a specific IP. Right now I'm just doing this:

twitter_user_name = Twitter.user(user_id).screen_name

So, how can I do to make those requests using the Twitter gem using the auth provided by OmniAuth instead of doing requests from my own IP (unauthenticated calls and therefore limited)

Nobita
  • 23,519
  • 11
  • 58
  • 87

1 Answers1

0

After playing with the gem, I've figured how to do it:

You want to create a new API object for a specific User, so you want to do this:

client = Twitter::Client.new(:oauth_token => 'XXXXX', :oauth_token_secret => 'XXXX')

And use this client to do the requests.

Nobita
  • 23,519
  • 11
  • 58
  • 87