I am facing problem in fetching reports using xero api. I also fetched invoices and accounts but when I fetch reports then I get error as mentioned in catch block. Here is code what I have tried.
app.get("/reports", async function(req, res) {
try {
const accessToken = req.session.accessToken;
await xero.setTokenSet(accessToken);
const apiResponse = await xero.accountingApi.getReportTrialBalance(
req.session.xeroTenantId
);
res.send({ invoices: apiResponse.body });
} catch (err) {
res.send("Sorry, something went wrong");
}
});