gpt4 book ai didi

ruby-on-rails - 错误——omniauth : (facebook) Authentication failure

转载 作者:行者123 更新时间:2023-12-04 06:20:35 25 4
gpt4 key购买 nike

我使用最新的 Omniauth Facebook 遇到以下错误 gem :
ERROR -- omniauth: (facebook) Authentication failure! invalid_credentials: OAuth2::Error, :
我的凭据是正确的,我似乎点击了 facebook 好,但回调错误。

有任何想法吗?

最佳答案

我遇到的问题是我的应用程序使用的是旧版本的 facebook API。
Omniauth-facebook 使用默认的 API 版本,在我的例子中是 2.4,但我的应用程序需要一个更新的版本,因为它在我的 Facebook 开发者控制台中是这么说的。就我而言,我所要做的就是将 omniauth-facebook gem 更新到版本 4.0。

如果您愿意,可以设置要使用的 Facebook API 版本,而不是像这样使用默认值(omniauth-facebook docs):

use OmniAuth::Builder do
provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'],
client_options: {
site: 'https://graph.facebook.com/v3.0', # this is the example API version
authorize_url: "https://www.facebook.com/v3.0/dialog/oauth"
}
end

您可以通过转到您的 facebook 开发者控制台来检查您的应用程序正在使用哪个 API 版本。 enter image description here

您可以在此处阅读有关 omniauth-facebook gem API 的更多信息:
http://www.rubydoc.info/gems/omniauth-facebook/4.0.0#API_Version

关于ruby-on-rails - 错误——omniauth : (facebook) Authentication failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43174419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com