I'm getting the following error using the latest Omniauth Facebook
gem:
ERROR -- omniauth: (facebook) Authentication failure! invalid_credentials: OAuth2::Error, :
My credentials are correct and i seem to hit facebook ok but the callback errors out.
Any ideas?
The problem I had was that my app was using an older version of the facebook API. Omniauth-facebook uses a default API version, in my case 2.4 but my App needed a newer version because that is what it said in my Facebook Developer Console. In my case, all I had to do was to update the omniauth-facebook gem to version 4.0.
If you wish you can set the Facebook API version that you want to use instead of using the default like this (omniauth-facebook docs):
use OmniAuth::Builder do
provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'],
client_options: {
site: 'https://graph.facebook.com/v3.0', # this is the example API version
authorize_url: "https://www.facebook.com/v3.0/dialog/oauth"
}
end
You can check which API verison your app is using by going to your facebook developer console.
You can read more about the omniauth-facebook gem API here: http://www.rubydoc.info/gems/omniauth-facebook/4.0.0#API_Version
I had the same problem but specifying version didn't help me. I end up passing token_params: { parse: :json }
something like below which resolved my issue :
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, Figaro.env.fb_appid, Figaro.env.fb_sec,
{ scope: 'email', token_params: { parse: :json } }
end
I have found the reference #174 comment
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