我正在构建一个Rails应用程序,其中有Omniauth个用于登录服务.为了验证谷歌,我使用的是OmniAuth Google OAuth2 Strategy.
当用户点击"允许访问"按钮时,一切正常.但当用户点击"不感谢"按钮时,会出现以下错误.
OmniAuth::Strategies::OAuth2::CallbackError
我已try 在应用程序控制器中添加以下救援代码.
class ApplicationController < ActionController::Base
rescue_from OmniAuth::Strategies::OAuth2::CallbackError, :with =>
:omniauth_callback_error_handler
protected
def omniauth_callback_error_handler
redirect_to init_sign_in_users_path
end
end
但运气不好.知道吗?