Timeout when trying to authenticate
megaton ~> skyjam --auth
https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=256941431767.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fmusicmanager
code:
PASTED_ACCESS_CODE_FROM_GOOGLE
/usr/lib/ruby/2.3.0/net/http.rb:880:in `initialize': execution expired (Faraday::ConnectionFailed)
from /usr/lib/ruby/2.3.0/net/http.rb:880:in `open'
from /usr/lib/ruby/2.3.0/net/http.rb:880:in `block in connect'
from /usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
from /usr/lib/ruby/2.3.0/net/http.rb:878:in `connect'
from /usr/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
from /usr/lib/ruby/2.3.0/net/http.rb:852:in `start'
from /usr/lib/ruby/2.3.0/net/http.rb:1398:in `request'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
from /home/colin/.gem/ruby/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
from /home/colin/.gem/ruby/2.3.0/gems/oauth2-0.9.4/lib/oauth2/client.rb:93:in `request'
from /home/colin/.gem/ruby/2.3.0/gems/oauth2-0.9.4/lib/oauth2/client.rb:138:in `get_token'
from /home/colin/.gem/ruby/2.3.0/gems/oauth2-0.9.4/lib/oauth2/strategy/auth_code.rb:29:in `get_token'
from /home/colin/.gem/ruby/2.3.0/gems/skyjam-0.5.3/lib/skyjam/client.rb:121:in `oauth2_setup'
from /home/colin/.gem/ruby/2.3.0/gems/skyjam-0.5.3/lib/skyjam/library.rb:8:in `auth'
from /home/colin/.gem/ruby/2.3.0/gems/skyjam-0.5.3/bin/skyjam:17:in `<module:SkyJam>'
from /home/colin/.gem/ruby/2.3.0/gems/skyjam-0.5.3/bin/skyjam:12:in `<top (required)>'
from /home/colin/.gem/ruby/2.3.0/bin/skyjam:23:in `load'
from /home/colin/.gem/ruby/2.3.0/bin/skyjam:23:in `<main>'
Seems like it's timing out on get_token?
Seems like if I bump up the timeout within the oauth2 gem by hacking the source code, it works eventually. I have some problems with my network, and/or Google's OAuth servers are slow.
I edited ~/.gem/ruby/2.3.0/gems/oauth2-0.9.4/lib/oauth2/client.rb, adding req.options.timeout = 600 to line 94. I'm not how to pass any options to Faraday through Oauth2::Client, so opted for this quick hack.
(Interestingly enough, even though I set the timeout to 10 minutes, the time it took wasn't nearly as long. I'm guessing Faraday's default timeout setting is just short enough that it errors out on me.)
@evaryont - having the exact same issue. Makes no sense why that POST call would take so long. If i step through oauth with the debugger, copy all the params of a call and cURL it manually I get a response instantly, of course.
Not sure whose problem this is. Is it Oauth, Faraday, Ruby-2.3.0, my router, or OSX config somewhere.
Same as in your case, increasing the timeout made it go through, so thanks for that tip, but there is no way that request should take so long.
Did you discover anything else that might help?
Unfortunately, I haven't worked on any projects using this gem since then. Beyond the timeout trick, I haven't found anything new.