2

I am using Omniauth in a Rails application for login, my omniauth.rb, is as show below:

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
   provider :facebook, 'xxxxxxx', 'xxxxxxx'
   provider :google_oauth2, 'xxxxxxxxx','xxxxxxxx'
end

When a user attempts to login (via Facebook or Goolge) and denies permissions, get the following error:

 OmniAuth::Strategies::OAuth2::CallbackError 

with this parameters:

{"error"=>"access_denied",
 "error_code"=>"200",
 "error_description"=>"Permissions error",
 "error_reason"=>"user_denied",
 "state"=>"60daee5f78d9cc28972050ae8ca8f950bb4ed5958302bcea"}

if the user accept, no problem and everything works fine.

I've tried some of the possible solutions related with this error, and listed on this website, but none solved my problem. For example:

How to rescue OmniAuth::Strategies::OAuth2::CallbackError?

Omniauth+facebook error when trying to cancel the popup

Please, I need help to solve this problem.

Community
  • 1
  • 1
user3100897
  • 21
  • 1
  • 2
  • The first answer you linked definitely covers your problem. You probably just forgot to restart. Every time you change config files, you have to restart the Rails app. – Ashitaka Dec 14 '13 at 03:21
  • possible duplicate of [How to rescue OmniAuth::Strategies::OAuth2::CallbackError?](http://stackoverflow.com/questions/10737200/how-to-rescue-omniauthstrategiesoauth2callbackerror) – Ashitaka Dec 14 '13 at 03:22

2 Answers2

0

there is another thread (posted here) with a solution that could help you. But it always redirects to a general failure page for every type of error; meaning that regardless of the provider, it will redirect to the same error page.

How to rescue OmniAuth::Strategies::OAuth2::CallbackError?

Community
  • 1
  • 1
0

If you are using Devise with OmniAuth you need to skip the extra omniauth.rb initializer and simply config.provider "KEY", "SECRET" inside of initializers/devise.rb and then carry on with your implementation.

rahul patil
  • 657
  • 6
  • 12