OmniAuth and Rails 3.1

Leonardo Mateo
Thu, 22 Sep 2011 23:54:19 -0000

Hi guys,
I''ve been struggling with OmniAuth for Twitter for a past few days and
I can''t get it to work with Rails 3.1
I''m not sure if this is a Twitter problem, or an OmniAuth problem.

I create the application on twitter, the steps vary a bit from the
Railscast showing it, but that''s because of a Twitter UI change,
nothing big.
The thing is I get my app registered on Twitter, I get my
consumer_secret and my consumer_key, then I setup my omniauth
initializer with:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, ''82I2sVYTqpxB9Pblahblahblah'',
''VkiJYnbLSN4qs99diwsdjfasweirblahblahblah''
end

Then, I restart my server, browse /auth/twitter and I get an
OAuth::Unauthorized error. This is the server log:
Started GET "/auth/twitter" for 127.0.0.1 at 2011-09-22 20:30:33 -0300

OAuth::Unauthorized (401 Unauthorized):

Rendered
/home/kandalf/.rvm/gems/ruby-1.9.3-preview1/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.2ms)
Rendered
/home/kandalf/.rvm/gems/ruby-1.9.3-preview1/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(21.8ms)
Rendered
/home/kandalf/.rvm/gems/ruby-1.9.3-preview1/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (25.3ms)

Any help would be very much appreciated.

Thanks a lot in advance.