auth / google_oauth2无法在rails app

时间:2015-07-30 17:56:07

标签: ruby-on-rails ruby authentication rubygems google-oauth2

我能够使用Facebook进行身份验证,并希望尝试谷歌我的rails应用程序,但在安装gem omniauth-google-oauth2并将正确的代码提供给omniauth.rb后,我无法使其工作到url / auth / google_oauth2

这是我的代码:

    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方法设置路由。

我有什么问题吗?

1 个答案:

答案 0 :(得分:1)

尝试指导:

/ AUTH /谷歌