views:

54

answers:

1

Hello All, I am new to Rails and I am trying to use omniauth with rails 2.3.8. I couldn't find any tutorial for this version of rails so I referred to http://blog.railsrumble.com/blog/2010/10/08/intridea-omniauth.

I added the initializer as follows:

omniauth.rb

OmniAuth::Strategies::Twitter = { 
    :consumer_key => 'xxxxxx', 
    :consumer_secret => 'xxxxxx' 
} 

After this step if I try to hit the URL '/auth/twitter' then I get "No route matches "/auth/twitter" with {:method=>:get}".

Has anyone used omniauth with rails 2.3.8? Please help.

Thanks & Regards,

Govind N

A: 

OmniOauth is a Rack::Middleware. So you need use it like that.

So you need add like that :

ActionController::Dispatcher.middleware.use OmniAuth::Strategies::Twitter = { 
    :consumer_key => 'xxxxxx', 
    :consumer_secret => 'xxxxxx' 
} 
shingara
Thanks! This worked for me! My initializer file (omniauth.rb) now looks like this:ActionController::Dispatcher.middleware.use OmniAuth::Strategies::Twitter, 'xxxconsumer_keyxxx', 'yyyconsumer_secretyyy'
Govind N
so upvote and accept the answer :)
shingara