I have currently implemented a NodeJs, express api with the xero-node
sdk package, and I've run into an issue where it doesn't seem that the OAuth state parameter is not being used (though I see it is defined as an optional parameter for the XeroClient constructor:
export interface IXeroClientConfig {
clientId: string,
clientSecret: string,
redirectUris: string[],
scopes: string[],
state?: string
}
Can anyone confirm if this has been implemented yet?
I am assuming it would work like this:
const xero = new XeroClient({
clientId: xeroParams.clientId,
clientSecret: xeroParams.clientSecret,
redirectUris: [xeroParams.redirectUrl],
scopes: xeroParams.scopes.split(' '),
state: this.callback_state,
});
//then when building the consent url like this, the state param would be included
const consentUrl = await xero.buildConsentUrl();
And then when the callback gets triggered I was expecting to be able to access the state code
as one of the query params. Something along the lines explained here
I have seen the session_state
parameter being returned but this is not matching the state code I supplied.