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