开发者

OmniauthCallbacksController#failure - when clicking "Don't Allow" for facebook connect

开发者 https://www.devze.com 2023-03-14 11:22 出处:网络
using rails 3 + devise + omniauth to facebook connect. In the permissions dialog, if the user clicks \"don\'t allow\" the user is redirected to:

using rails 3 + devise + omniauth to facebook connect. In the permissions dialog, if the user clicks "don't allow" the user is redirected to:

Started GET "/users/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." for 127.0.0.1 at Mon Jun 20 16:54:42 -0700 2011
  Processing by Devise::OmniauthCallbacksController#failure as HTML
  Parameters: {"error_description"=>"The user denied your request.", "error_reason"=>"user_denied", "error"=>"access_denied"}
Redirected to http://localhost:3000/users/sign_in
Completed 302 开发者_如何学JAVAFound in 2ms

How can I gain control and serve a .js file to handle this gracefully. Right now, it is redirecting to the root and showing the site is a small little dialog.

Ideas? Thanks


Seems you are using omniauthable from devise. In this case, you can see the code for Devise::OmniauthCAllbackController#failure action here.

So, you gain the controller you have to create a controller say omniauth_controller as -

class OmniauthController < Devise::OmniauthCAllbackController

   def failure
      #handle you logic here..
      #and delegate to super.
      super
   end
end

This should work. Also you need to add "devise_for" routes for your omniauth controller.

0

精彩评论

暂无评论...
验证码 换一张
取 消