I provide a "log in with twitter" link to /auth/twitter , which handles gem omniauth .
On my development machine, this works fine, redirecting to the twitter login page and returning to the set of callbacks for the application on dev.twitter.com (http://127.0.0.1haps000/auth/twitter/ callback).
I have a separate application registered for our test production server, with the only difference being the access token, secret and callback. Access to the /auth/twitter path on the production server results in
OAuth::Unauthorized (401 Unauthorized): oauth (0.4.6) lib/oauth/consumer.rb:216:in `token_request' oauth (0.4.6) lib/oauth/consumer.rb:136:in `get_request_token' ...
I made sure that the server really uses my development key / secret by printing the ones that were used for the log, as they are installed in /config/initializers/omniauth.rb . They correspond to those indicated on the Twitter page, and the registered callback is a valid address and points to the production server.
What could be wrong here? Could this be the result of speed limits?
The following is a gemfile:
source 'https://rubygems.org' gem 'rails', '3.2.3' gem 'mysql2','0.3.11' gem 'tweetstream' gem 'koala' group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'twitter-bootstrap-rails' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' gem 'twitter' gem 'omniauth-twitter' gem 'omniauth-facebook' gem 'thin'
/config/initializers/omniauth.rb:
puts "initializing twitter with #{TWITTER_KEY}, #{TWITTER_SECRET}" Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter, TWITTER_KEY, TWITTER_SECRET provider :facebook, FACEBOOK_KEY, FACEBOOK_SECRET, :scope => 'read_stream,publish_stream' end
The server registers the correct key and secret in the first line here.