Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 没有与[GET]匹配的路由/auth/facebook";在RubyonRails4中_Ruby On Rails_Ruby On Rails 4_Omniauth Facebook - Fatal编程技术网

Ruby on rails 没有与[GET]匹配的路由/auth/facebook";在RubyonRails4中

Ruby on rails 没有与[GET]匹配的路由/auth/facebook";在RubyonRails4中,ruby-on-rails,ruby-on-rails-4,omniauth-facebook,Ruby On Rails,Ruby On Rails 4,Omniauth Facebook,当我使用omniauth,rails 4.2.1时,我遇到了这个错误。我已经安装了omniauth gem和omniauth facebook routes.rb get 'auth/:provider/callback', to: 'users#create' get 'auth/failure', to: redirect('/') get 'signout', to: 'users#destroy', as: 'signout' 初始化者/omniauth.rb OmniAuth.con

当我使用omniauth,rails 4.2.1时,我遇到了这个错误。我已经安装了omniauth gem和omniauth facebook

routes.rb

get 'auth/:provider/callback', to: 'users#create'
get 'auth/failure', to: redirect('/')
get 'signout', to: 'users#destroy', as: 'signout'
初始化者/omniauth.rb

OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 'APP_KEY', 'APP_SEC_KEY'
end
我发现了这个错误

No route matches [GET] "/auth/facebook"

有谁能帮我一下吗?我做了很多研究和尝试,但似乎都不管用。

您是否使用Desive gem进行身份验证?如果是,则不应使用“initializers/omniauth.rb”,而应使用“/initializers/designe.rb”,以及用户模型中的“omniauthable”。一个很好的教程:

你试过这个吗。还要检查你的facebook配置是否正确自从安装gem后你是否重新启动了服务器?同时在你的控制台中运行
rake routes
,看看它为facebook提供了什么输出(搜索“facebook”)@Dipak我试过stackoverflow,但在我的系统中不起作用case@miler350它在我的localhost(即,[)中运行良好,但在我的开发服务器中不起作用。“rake路由”是“GET/auth/:provider/callback”(:format)“'auth_failure GET/auth/failure(:format)”“signout GET/signout(:format)”您是否在facebook上为开发服务器设置了不同的应用程序?