In my rails application, I need to use Twitter Oauth twice for two different purposes. The first is a typical user input. The second is to add accounts so that tweets can be scheduled in advance. Think of Hootsuite as an example. You can log in using Facebook, as well as connect to various Facebook accounts. This requires two separate callbacks.
To make callbacks with unique functions, I decided that I could just create two different applications, each of which has a separate callback URL.
However, the omniauth.rb file has only one way to connect to the twitter provider.
Rails.application.middleware.use OmniAuth::Builder do provider :twitter, ENV["TWITTER_KEY"], ENV["TWITTER_SECRET"] end
It will not happen again:
Rails.application.middleware.use OmniAuth::Builder do provider :twitter, ENV["TWITTER_KEY"], ENV["TWITTER_SECRET"] end Rails.application.middleware.use OmniAuth::Builder do provider :twitter, ENV["TWITTERUSER_KEY"], ENV["TWITTERUSER_SECRET"] end
Because there is no way to distinguish which callback to use. I did not find a way to make a provider: twitter2 'for example, because it is built into Omniauth.
Has anyone found a solution to use multiple Twitter callbacks in one application? I am glad to see a solution with any Oauth that needs to be used twice for different purposes, for example Facebook or Google Plus.
Thanks!
source share