Ruby omniauth-oauth2 - A Errno :: ENETUNREACH - Network unavailable - connect (2)

Sometimes the My Rails application (about 2 weeks) crashes during the callback method when a user tries to log in using facebook.

This happens randomly, and I cannot find a way to solve this problem.

Below error and stacktrace element:

A Errno :: ENETUNREACH occurred in #: Network is unavailable - connect (2)

  • REQUEST_METHOD: GET
  • REQUEST_PATH: / auth / facebook / callback
  • REQUEST_URI: / author / facebook / callback code = AQDoUnHaO4ShfZUtCw6TVHAd_oOWUQ7Lar-OunhlFHoWhpTmiliY8hWTEb0CmufEMABpUggIlAe15jx8BOxTmVXmHb3JvVlePEfECpkVhf82UWdoHK8jCYN00KM5RYUkbx6M5SHjusb2xWFeHnE92-nfvbpw2KSARqR5njgJqbV_hkJYb42SiuvNXKOTU6hYY_g

------------------------------- Backtrace:

 /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 '
+8
ruby ruby-on-rails facebook
source share
2 answers

It sounds like I need repeated access requests, but this is an unprovable guess.

Theres a bunch of things that stopped the callback from working for me before I got it to work:

  • internet connection all together
  • no route in config / routes
  • bad javascript
  • Callback url does not match facebook app
  • obsolete version of oauth .. etc.

Feel free to double check what you have with what I got and see if this helps:

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

0
source share
Was the problem resolved somehow? I also come across this.

Another discussion: https://github.com/mkdynamic/omniauth-facebook/issues/80

Btw, did you check open ports?

0
source share

All Articles