gpt4 book ai didi

ruby-on-rails - Ruby omniauth-oauth2 - A Errno::ENETUNREACH - 网络无法访问 - 连接(2)

转载 作者:数据小太阳 更新时间:2023-10-29 06:55:10 26 4
gpt4 key购买 nike

当用户尝试使用 facebook 登录时,我的 Rails 应用程序有时(大约 2 周后)在回调方法期间崩溃。

这是随机发生的,我找不到解决这个问题的方法。

下面是错误和一段堆栈跟踪:

Errno::ENETUNREACH 发生在#:网络无法访问 - connect(2)

  • REQUEST_METHOD:获取
  • REQUEST_PATH :/auth/facebook/callback
  • REQUEST_URI :/auth/facebook/callback?code=AQDoUnHaO4ShfZUtCw6TVHAd_oOWUQ7Lar-OunhlFHoWhpTmiliY8hWTEb0CmufEMABpUggIlAe15jx8BOxTmVXmHb3JvVlePEfECpkVhf82UWdoHK8jCYN00KM5RYUkbx6M5SHjusb2xWFeHnE92-nfvbpw2KSARqR5njgJqbV_hkJYb42SiuvNXKOTU6hYY_g

---------------------------- 回溯:

/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `initialize'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `open'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `connect'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start'/home/finetuning/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1284:in `request'faraday (0.7.6) lib/faraday/adapter/net_http.rb:61:in `call'faraday (0.7.6) lib/faraday/request/url_encoded.rb:14:in `call'faraday (0.7.6) lib/faraday/connection.rb:210:in `run_request'oauth2 (0.5.2) lib/oauth2/client.rb:88:in `request'oauth2 (0.5.2) lib/oauth2/client.rb:128:in `get_token'oauth2 (0.5.2) lib/oauth2/strategy/auth_code.rb:29:in `get_token'omniauth-oauth2 (1.0.0) lib/omniauth/strategies/oauth2.rb:77:in `build_access_token'omniauth-facebook (1.2.0) lib/omniauth/strategies/facebook.rb:63:in `block in build_access_token'omniauth-facebook (1.2.0) lib/omniauth/strategies/facebook.rb:110:in `with_authorization_code'omniauth-facebook (1.2.0) lib/omniauth/strategies/facebook.rb:63:in `build_access_token'omniauth-oauth2 (1.0.0) lib/omniauth/strategies/oauth2.rb:61:in `callback_phase'

最佳答案

这听起来像是需要向我重新请求访问 token ,但这是一个不为人知的猜测。

在我让它工作之前,有很多事情阻止了回调对我的工作:

  • 互联网连接全部停止
  • config/routes 中没有路由
  • 糟糕的javascript
  • 回调 url 与 facebook 应用程序不匹配
  • oauth 的过时版本..等..

请随时仔细检查您的工作和我的工作,看看是否有帮助:

http://www.ajostrow.me/thoughts/client-side-facebook-authentication-with-rails

关于ruby-on-rails - Ruby omniauth-oauth2 - A Errno::ENETUNREACH - 网络无法访问 - 连接(2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12295136/

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