我有問題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]
我的錯誤在哪裏? 感謝您的任何提前!