Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout option not set correctly on OAuth 2 client #527

Closed
artspool-nyc opened this issue Jan 6, 2021 · 3 comments
Closed

Timeout option not set correctly on OAuth 2 client #527

artspool-nyc opened this issue Jan 6, 2021 · 3 comments

Comments

@artspool-nyc
Copy link

It seems that the OAuth 2 client uses a connection_opts hash to set the timeout options, and this is currently empty even when initializing Xeroizer::OAuth2Application with a timeout option per issue #296. The options I'm seeing on the OAuth2::Client when making a request are:

 :authorize_url => "https://login.xero.com/identity/connect/authorize"
 :token_url => "https://identity.xero.com/connect/token"
 :token_method => :post
 :auth_scheme => :request_body
 :connection_opts => Empty Hash
 :connection_build => nil
 :max_redirects => 5
 :raise_errors => false
 :xero_url => "https://api.xero.com/api.xro/2.0"
 :tenets_url => "https://api.xero.com/connections"
 :unitdp => 4
 :timeout => 20
 :access_token => "the-access-token"
 :tenant_id => "the-tenant-id"

Is there a different way we should be initializing the Xeroizer::OAuth2Application to pass in the timeout options? See Slow OAuth Providers in the oauth2 docs for more info.

@xxswingxx
Copy link

I started noticing Faraday::TimeoutError: Net::ReadTimeout exceptions due to this I think.

@xxswingxx
Copy link

xxswingxx commented Apr 13, 2021

@artspool-nyc I think you can pass connection_opts: { request: { timeout: 300 } } directly through the Xeroizer::OAuth2Application initializer options:

Xeroizer::OAuth2Application.new(client_id, client_secret, 
  connection_opts: { request: { timeout: 300 } },
  rate_limit_sleep: 2,
  unitdp: 4,
  tenant_id: tenant_id
)

For what I'm seeing this options are passed directly from the Xeroizer::OAuth2Application initializer (https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/oauth2_application.rb#L32) to the Xeroizer::OAuth2 initializer (https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/oauth2.rb#L9) and from there to the regular OAuth2::Client

@rjaus
Copy link
Collaborator

rjaus commented Sep 21, 2021

@rjaus rjaus closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants