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.
精彩评论