I am using Omniauth 1.0.1 in my Rails app for authentication. I have "omniauth-google-oauth2" gem for Google provider. But it shows me the error as
`rescue in provider': Could not find matching strategy for :google. You may need to install an additional gem (such as omniauth-google). (LoadError).
I gave "provider :google, 'domain.com', 'secret', :scope => 'https://mail.google.com/mail/feed/atom/'" in my initializers. Could u please tell me what went wrong? Thank u.
OmniAuth is a gem for Rails that lets you use multiple authentication providers alongside the more traditional username/password setup. 'Provider' is the most common term for an authentication partner, but within the OmniAuth universe we refer to providers (e.g., using a GitHub account to log in) as strategies.
The Omniauth Google OAuth2 gem will validate the code via a server-side request to Google. If the code is valid, then Google will return an access token and, if this is the first time this user is authenticating against this application, a refresh token. Both of these should be stored on the server.
Try using
:google_oauth2
as your provider.
Since version 1.0, omniauth has taken out the individual strategies into separate gems. For more info, visit omniauth's page, and/or listen to eg this excellent railscast.
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