我已经使用omniauth gem实现了twitter和facebook身份验证,但是当我尝试使用openID或google进行身份验证时,我得到:没有路由匹配[GET]" / auth / google_apps"或者没有路线匹配[GET]" / auth / open_id"错误
我的omniauth.rb文件是:
require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :openid, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'openid'
provider :openid, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
我的routes.rb是:
match '/auth/:provider/callback', to: 'authentications#create'
我的Gemfile是这样的:
#for user authentication
gem 'devise'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-openid'
gem 'omniauth-google-oauth2'
我必须在我的代码中添加其他任何内容来运行OpenID和Google身份验证吗? 感谢
答案 0 :(得分:0)
您的来电是错误的。你应该致电:
/auth/google
答案 1 :(得分:0)
provider :openid, :store => OpenID::Store::Filesystem.new('./tmp')
使用此代码,并链接/ auth / google