Skip to content

OAuth Client Connection Options Timeouts

Riley James edited this page Sep 21, 2021 · 1 revision

Q&A Regarding issue: https://github.com/waynerobinson/xeroizer/issues/527

If you need to change these settings for your OAuth Client connections to the XeroAPI, for example: to set a timeout on the client.

 :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"

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

Clone this wiki locally