Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise with omniauth-facebook "Invalid Credentials"

I'm trying to get Facebook authentication working with Devise through omniauth-facebook, I've followed the instructions here: https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview

When I follow the login with Facebook link I am redirected to Facebook to login and accept the requested permissions.

I am then taken back to /users/sign_in with the error message "Could not authorize you from Facebook because "Invalid credentials""

Looking at the server logs the redirect comes from "/users/auth/facebook/callback?code=[long text string]" which is being processed with Users::OmniauthCallbacksController#failure rather than Users::OmniauthCallbacksController#facebook as I would have expected if it had worked.

Any suggestions as to why this is happening and how to resolve it much appreciated.

like image 419
TalkingQuickly Avatar asked Dec 09 '11 12:12

TalkingQuickly


1 Answers

Ok, I had the very same issue. The reason for me turned out that I had defined this line in config/initializers/devise.rb:

config.omniauth :facebook ...

The app id and app secret were defined for my test Facebook app, and for production one. Fixing those id:s now fixed the problem.

like image 109
Alexander Savin Avatar answered Nov 10 '22 18:11

Alexander Savin