使用全真身份验证脸书登录时执行过期错误



自7月3日起,用户无法从Facebook登录。 我正在使用omniauth-facebook。我测试了从本地主机成功登录(指向另一个FB测试应用程序)。但在生产环境中,应用程序会显示此错误:

Started GET "/auth/facebook" for 190.238.101.80 at 2019-07-10 17:53:51 -0500
I, [2019-07-10T17:53:51.594796 #4707]  INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/auth/facebook/callback?code=AQAj5FOJuHu7UY656lbwZ4Sfcf_J_ZX9Z_t0wRT-LDfnPLU530zKj5CNGEK53yJ9maNj8O80fWgGmxCq4zWqBK7CPN-ovokGZVIvfY0KaqzNRXWOC20kH4KhkYOHjPyRh4tMYTIcHZ1a0BvHfbBLVolYECVtfD1OKJ2Xob07LCpS0SHNhYc6PA3rBAnb6GnkvOZI-8S7nwXIICdFoKu0BbHd-6L8_Dq-dPFTOpJDSWgmoJUBc65EyCnuw7NCI4IFP1UtxtOmB_QjuzRQV-voQs_SV6N97c2ICK_Qc-IqL_WBwqd54aEzdnW5UOsDV4Wo0jA&state=cee86047aecb4d282b80d33bbd0469815a17d25566167d95" for 190.238.101.80 at 2019-07-10 17:53:52 -0500
I, [2019-07-10T17:53:52.082829 #4707]  INFO -- omniauth: (facebook) Callback phase initiated.
Faraday::ConnectionFailed (execution expired):
/usr/lib/ruby/2.5.0/net/http.rb:937:in `initialize'
/usr/lib/ruby/2.5.0/net/http.rb:937:in `open'
/usr/lib/ruby/2.5.0/net/http.rb:937:in `block in connect'
/usr/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/usr/lib/ruby/2.5.0/net/http.rb:935:in `connect'
/usr/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
/usr/lib/ruby/2.5.0/net/http.rb:909:in `start'
/usr/lib/ruby/2.5.0/net/http.rb:1458:in `request'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:87:in `perform_request'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:43:in `block in call'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
faraday (0.15.4) lib/faraday/adapter/net_http.rb:38:in `call'
faraday (0.15.4) lib/faraday/request/url_encoded.rb:15:in `call'
faraday (0.15.4) lib/faraday/rack_builder.rb:143:in `build_response'
faraday (0.15.4) lib/faraday/connection.rb:387:in `run_request'
oauth2 (1.4.1) lib/oauth2/client.rb:99:in `request'
oauth2 (1.4.1) lib/oauth2/client.rb:146:in `get_token'
oauth2 (1.4.1) lib/oauth2/strategy/auth_code.rb:30:in `get_token'
omniauth-oauth2 (1.6.0) lib/omniauth/strategies/oauth2.rb:89:in `build_access_token'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:110:in `build_access_token'
omniauth-oauth2 (1.6.0) lib/omniauth/strategies/oauth2.rb:73:in `callback_phase'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:67:in `block in callback_phase'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:131:in `with_authorization_code!'
omniauth-facebook (5.0.0) lib/omniauth/strategies/facebook.rb:66:in `callback_phase'
omniauth (1.9.0) lib/omniauth/strategy.rb:238:in `callback_call'
omniauth (1.9.0) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.9.0) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.0) lib/omniauth/builder.rb:64:in `call'
rack (1.6.11) lib/rack/etag.rb:24:in `call'
rack (1.6.11) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.11) lib/rack/head.rb:13:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.11) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.11) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.8) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.8) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.8) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.8) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.8) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.8) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.11) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.11) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.8) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.11) lib/rack/sendfile.rb:113:in `call'
actionpack (4.2.8) lib/action_dispatch/middleware/ssl.rb:24:in `call'
railties (4.2.8) lib/rails/engine.rb:518:in `call'
railties (4.2.8) lib/rails/application.rb:165:in `call'
rack (1.6.11) lib/rack/content_length.rb:15:in `call'
thin (1.7.2) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.7.2) lib/thin/connection.rb:84:in `catch'
thin (1.7.2) lib/thin/connection.rb:84:in `pre_process'
thin (1.7.2) lib/thin/connection.rb:53:in `process'
thin (1.7.2) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.2.7) lib/eventmachine.rb:195:in `run_machine'
eventmachine (1.2.7) lib/eventmachine.rb:195:in `run'
thin (1.7.2) lib/thin/backends/base.rb:73:in `start'
thin (1.7.2) lib/thin/server.rb:162:in `start'
rack (1.6.11) lib/rack/handler/thin.rb:19:in `run'
rack (1.6.11) lib/rack/server.rb:287:in `start'
railties (4.2.8) lib/rails/commands/server.rb:80:in `start'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:75:in `tap'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.8) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.8) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<main>'

我尝试使用本地主机与Facebook创建一个测试应用程序,它可以工作。 我尝试使用另一个域的生产中的另一个应用程序,它可以工作。 它不适用于生产中的此特定应用程序。我给Facebook的支持发了消息,但他们没有回复,几天过去了。

我正在使用 RoR 4.2.8,捆绑器 1.17.3 我尝试使用 ruby-2.5.1 和 ruby-2.3.3 以防万一(同样的错误)

我尝试使用另一个具有相同设置的 Facebook 应用程序,使用另一个带有 ruby-5 的 RoR v2.6 应用程序并且它有效,因此 FB 应用程序设置似乎还可以。

我创建了另一个FB应用程序,以尝试使用失败的RoR v4.2.8应用程序,它失败并出现相同的"法拉第::连接失败(执行已过期):"错误。

config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'APP-ID', 'SECRET',
scope: 'email'
end

用户应该能够使用Facebook登录,但它失败并显示"Faraday::ConnectionFailed(执行已过期):">

从表面上看,您遇到了一个网络问题,法拉第没有设置为等待足够长的响应时间。我从跟踪中真正能看出的是,沿着通往Facebook和返回的小径的某个地方,您遇到了网络问题。

我可以想到的几件事来检查:

  • 如果您的站点通过 HTTPS 运行,请确保您的证书正常工作。
    • 检查您的 gemfile 是否设置为需要与您的 Rails 版本和依赖项兼容的特定omniauth-facebook版本。
    • 延长法拉第的超时长度
    • 使用像 https://github.com/ooyala/retries 这样的重试 gem 来尝试在 Faraday 关闭连接之前给网络足够的时间来响应。

其他一些人在omniauth-facebook的github https://github.com/mkdynamic/omniauth-facebook/issues/283 中对这个问题发表了评论。

相关内容

  • 没有找到相关文章

最新更新