Cannot override after_omniauth_failure_path_for in application

I have my class Users :: OmniauthCallbacksController <Develop :: OmniauthCallbacksController and I override the after_omniauth_failure_path_for method:

protected
  def after_omniauth_failure_path_for resource
    '/report_failure'
  end

But super is the one that gets called.

I suspect this is due to a workaround:

  devise_for :users do
    get '/users/auth/:provider'  => 'users/omniauth_callbacks#passthru'
  end

Does anyone know how to overcome this problem? I am using Devise 2.0.4

This is the log report:

Started GET "/users/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." for 77.124.184.115 at 2012-04-19 11:34:46 +0000
Processing by Devise::OmniauthCallbacksController#failure as HTML
  Parameters: {"error_reason"=>"user_denied", "error"=>"access_denied", "error_description"=>"The user denied your request."}
Redirected to http://myapp.com/users/sign_in
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)

Edit: if I remove the passthru redirect then it works:

#       def  devise_for :users do
#        get '/users/auth/:provider'  => 'users/omniauth_callbacks#passthru'
#      end

thank

+3
source share
1 answer

You forgot to add :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } parameters for the devise_for configuration, without it omniauth does not know which controller to redirect after a failure.

Btw, passthru . , , ?

0

All Articles