得到此错误没有路由匹配[GET]“/ auth / facebook”

时间:2014-08-22 15:32:09

标签: ruby-on-rails facebook omniauth

我试图在我的应用程序中使用facebook登录,我得到以下错误。我使用Rails 4.我在stackover流程中遇到了一些其他类似的查询并尝试了他们的建议,但它没有帮助

没有路线匹配[GET]“/ auth / facebook”

 routes.rb
get 'auth/:provider/callback', to: 'sessions#create'
  get 'auth/failure', to: redirect('/')
  get 'signout', to: 'sessions#destroy', as: 'signout'

初​​始化/ omniauth.rb

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, FACEBOOK_KEY, FACEBOOK_SECRET, {:client_options => {:ssl => {:ca_file => Rails.root.join("cacert.pem").to_s}}}
end

1 个答案:

答案 0 :(得分:0)

将您的路线修改为以下内容:

get 'auth/:provider', to: 'sessions#create'
get 'auth/failure', to: redirect('/')
get 'signout', to: 'sessions#destroy', as: 'signout'