Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone used omniauth with rails 2.3.8?

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?

like image 824
Govind N Avatar asked Oct 31 '10 10:10

Govind N


2 Answers

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' 
} 
like image 143
shingara Avatar answered Sep 24 '22 03:09

shingara


This is how it works for me in rails 2.3.8

omniauth.rb:

ActionController::Dispatcher.middleware.use OmniAuth::Builder do
  provider :facebook,
    "key", "secret", 
    :scope => %(email user_birthday publish_stream offline_access),
    :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
end
like image 28
Ivailo Bardarov Avatar answered Sep 23 '22 03:09

Ivailo Bardarov