关于 ruby??:auth/google_oauth2 不适用于 rails 应用程序

auth/google_oauth2 not working on rails app

我能够使用 Facebook 进行身份验证,并想在我的 rails 应用程序中尝试使用 Google,但在安装 gem omniauth-google-oauth2 并将正确的代码提供给 omniauth.rb 之后,我不能?网址 /auth/google_oauth2

这是我的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    OmniAuth.config.logger = Rails.logger

    Rails.application.config.middleware.use OmniAuth::Builder do
     provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'],
     :scope => 'email', :display => 'popup'
     provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"],
     {
         :name =>"google",
         :scope =>"email, profile, plus.me, http://gdata.youtube.com",
         :prompt =>"select_account",
         :image_aspect_ratio =>"square",
         :image_size => 50
     }


end

在我运行 bundle install 命令并尝试转到 /auth/google_oauth2 后,我收到错误 No route matches [GET]"/auth/google_oauth2"
我按照 gem 的说明进行操作,也不需要为 /auth/facebook 方法设置路由。

是不是我做错了什么?


/auth/google