Omniauth:回调未触发,返回失败并显示“无效凭据"; [英] Omniauth: callback not firing, returns failure with "invalid credentials"
问题描述
我的 Rails 应用程序中使用 Omniauth
gem 实现的 facebook 身份验证最近停止工作.
The facebook authentication in my Rails application, implemented with the Omniauth
gem has stopped working recently.
问题是回调应该使用的控制器操作没有被触发,并且该过程立即跳到失败并显示无效凭据"消息.
The problem is that the controller action, that should be used by the callback is not getting fired, and the process immediately skips to failure with "invalid credentials" message.
日志:
Started GET "/auth/facebook" for ::ffff:127.0.0.1 at 2017-03-29 11:12:29 +0200
Started GET "/auth/facebook/callback?code=<<code>>&state=<<state>" for ::ffff:127.0.0.1 at 2017-03-29 11:12:30 +0200
Started GET "/auth/failure?message=invalid_credentials&origin=<<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
有什么想法可能出问题了吗?
Any ideas what could be wrong?
我在使用 Google 授权时遇到了同样的问题.
I had the same problem with Google authorization.
推荐答案
更新 gems 到最新版本(omniauth 1.6.1 和 omniauth-facebook 4.0.0):
Updating gems to their newest versions (omniauth 1.6.1 and omniauth-facebook 4.0.0) with:
bundle update omniauth
bundle update omniauth-facebook
解决了这个问题.我将其留作将来参考.
solved the issue. I am leaving this for future reference.
同样适用于谷歌授权:
bundle update omniauth-google-oauth2
这篇关于Omniauth:回调未触发,返回失败并显示“无效凭据";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!