Reputation: 1875
I am using omniauth-facebook gem in my rails application to allow user to sign_in/sign_up via facebook. Its working well. But my problem is when I click on cancel button I am getting following error
(facebook) Callback phase initiated.
(facebook) Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, OmniAuth::Strategies::OAuth2::CallbackError
Started GET "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." for 127.0.0.1 at 2012-05-18 11:42:36 +0530
Whats the matter? Adding /auth/failure => 'pages#home' is also not working.Please help
Upvotes: 6
Views: 1658
Reputation: 1
OmniAuth.config.on_failure = Proc.new { |env|
[302, {'Location' => 'http://localhost:3001/login'}, []]
}
use this for fixing the error
Upvotes: 0
Reputation: 2606
Take a look at the last section on https://github.com/intridea/omniauth/wiki/FAQ and see if that helps. It suggests adding
OmniAuth.config.on_failure = Proc.new { |env|
OmniAuth::FailureEndpoint.new(env).redirect_to_failure
}
to your omniauth initializer. This worked for me locally, and then you just need to define your /auth/failure route & action.
Upvotes: 6
Reputation: 5940
I was having the same problem when debugging locally (localhost).
On a public url it worked, it probably needs FB to "see" you.
You can test on a public url or maybe use some king of tunnel (localtunnel is an ultra simple example).
HTH
Upvotes: 0