Skip to content

4.31.0

Compare
Choose a tag to compare
@RettBehrens RettBehrens released this 02 Dec 23:12
· 122 commits to master since this release
fc76e2d

XeroClient

  • Adds optional configurable httpTimeout
  • Adds optional configurable clockTolerance

Release Notes

const xero = new XeroClient({
  clientId: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_CLIENT_SECRET',
  redirectUris: [`http://localhost:${port}/callback`],
  scopes: 'openid profile email accounting.transactions offline_access'.split(" "),
  state: 'returnPage=my-sweet-dashboard', // custom params (optional)
  httpTimeout: 3000, // ms (optional)
  clockTolerance: 10 // seconds (optional)
});
public async initialize(): Promise<XeroClient> {
    if (this.config) {
      custom.setHttpOptionsDefaults({
        retry: {
          maxRetryAfter: this.config.httpTimeout || 3500
        },
        timeout: this.config.httpTimeout || 3500
      })

      const issuer = await Issuer.discover('https://identity.xero.com');
      this.openIdClient = new issuer.Client({
        client_id: this.config.clientId,
        client_secret: this.config.clientSecret,
        redirect_uris: this.config.redirectUris,
      });

      this.openIdClient[custom.clock_tolerance] = this.config.clockTolerance || 5;
    }

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)