I am using xero-node for javascript development but I am getting an error when I try and create the xero client. I call this code.
const consentUrl = await xero.buildConsentUrl()
I create the xero client with this code:
xero = new XeroClient({
clientId: clientId,
clientSecret: clientSecret,
redirectUris: URL_REDIRECTS,
scopes: ['openid', 'profile', 'projects']
//state: 'not_currently_used', // custom params (optional)
//httpTimeout: 3000 // ms (optional)
})
This throws the error:
index-C0C0EiKl.js:117 Uncaught (in promise) TypeError: only valid absolute URLs can be requested.
Looking at the debug I see it gets thrown in this code.
try {
t = new DX1(e.url), //thrown here
delete e.url,
RX1(/^(https?:)$/.test(t.protocol))
} catch {
throw new TypeError("only valid absolute URLs can be requested")
}
The e.url that it is using when it calls this code is https://identity.xero.com/.well-known/openid-configuration. When I put this URL in my browser it returns valid configuration data. So I have no idea why this URL is unacceptable.
I’d appreciate any help from a xero expert here please.