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' th开发者_C百科en I get "No route matches "/auth/twitter" with {:method=>:get}".
Has anyone used omniauth with rails 2.3.8?
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'
}
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
精彩评论