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