Omniauth:回调未触发,返回失败并显示“无效凭据”

我的Rails应用程序中使用Omniauth gem实现的facebook身份validation最近已停止工作。

问题是回调应该使用的控制器操作不会被触发,并且进程会立即跳过“无效凭据”消息而失败。

日志:

 Started GET "/auth/facebook" for ::ffff:127.0.0.1 at 2017-03-29 11:12:29 +0200 Started GET "/auth/facebook/callback?code=<>&state=<" for ::ffff:127.0.0.1 at 2017-03-29 11:12:30 +0200 Started GET "/auth/failure?message=invalid_credentials&origin=<>&strategy=facebook" for ::ffff:127.0.0.1 at 2017-03-29 11:12:31 +0200 Started GET "/login" for ::ffff:127.0.0.1 at 2017-03-29 11:12:31 +0200 Processing by UserSessionsController#new as HTML 

路线:

  match "/auth/failure" => redirect("/login"), :via => [:get, :post] match '/auth/:provider/callback' => 'user_sessions#create_omniauth', :via => [:get, :post] match '/auth/:provider/disconnect' => 'user_sessions#destroy_omniauth', :as => :destroy_auth, :via => :delete 

什么想法可能是错的?

编辑:我在Google授权方面遇到了同样的问题。

将gem更新为最新版本(omniauth 1.6.1和omniauth-facebook 4.0.0):

 bundle update omniauth bundle update omniauth-facebook 

解决了这个问题。 我将此留待以备将来参考。

编辑:

同样的事情适用于谷歌授权:

 bundle update omniauth-google-oauth2