Suhas Deshpande
Suhas Deshpande

Reputation: 725

How to use omniauth gem to get twitter user id?

I have a web application using omniauth-twitter gem for authentication purpose. I have to fetch the followers and following of the authenticated user into database But I am not able to figure out how would I use twitter gem to get the list of followers/following

Upvotes: 2

Views: 512

Answers (1)

Suhas Deshpande
Suhas Deshpande

Reputation: 725

I figured if you add the following lines of code to your omniauth.rb file which you must have created in / config / initializers / omniauth.rb, you have a twitter client and you are all set to use twitter gem. :-) It's fun to play around with Twitter gem. For more code, check out my project on github.. https://github.com/suhasdeshpande/DigFollowers

Rails.application.config.middleware.use OmniAuth::Builder do
   provider :twitter, 'Your Consumer key','Consumer Secret key'

   **Twitter.configure do |config|
    config.consumer_key = 'same goes here.. CK'
    config.consumer_secret = 'Consumer secret key'
   end**
end

Upvotes: 1

Related Questions