I have got
gem 'omniauth-google_oauth2'
in my Gemfile. Did bundle install after that as well. It errors out saying,
ruby-1.9.3-p0/gems/omniauth-1.0.2/lib/omniauth/builder.rb:33:in `rescue in provider': Could not find matching strategy for :google_oauth2. You may need to install an additional gem (such as omniauth-google_oauth2). (LoadError)
What am I missing? Any ideas please.
Use
gem 'omniauth-google-oauth2'
Change the last underscore to a hyphen.
The problem is caused by how OmniAuth camelizes the provider names:
OmniAuth::Utils.camelize(:google_oauth2.to_s)
=> GoogleOAuth2
However the provider is actually GoogleOauth2
- fully qualified - OmniAuth::Strategies::GoogleOauth2
So the solution is to use the fully qualified class:
OmniAuth::Strategies::GoogleOauth2
Rails.application.config.middleware.use OmniAuth::Builder do
provider OmniAuth::Strategies::GoogleOauth2, ENV["KEY"], ENV["SECRET"]
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With