我有问题omniauth-google-oath2宝石。Google omniauth无法识别路径
我的代码:
devise.rb
config.omniauth :google_oauth2, 'app_id','secret'
omniauth_callbacks_controller.rb
def google_oauth2
auth = env["omniauth.auth"]
@user = User.find_for_google_oauth2(request.env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.google_uid"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
我也在我user.rb模型提供find_for_google_oauth2方法。 在我html.erb我写道:
<%= link_to "With Google", user_omniauth_authorize_path(:google_oauth2) %>
而在最后,我有这样的错误:没有路由匹配{:控制器=> “omniauth_callbacks”:动作=> “中继”:供应商=> :google_oauth2,:format => nil}缺少必需的密钥:[:provider]
我的错误在哪里? 感谢您的任何提前!