Skip to content

Instantly share code, notes, and snippets.

xeroClient.core.invoices.getInvoice(req.body.invoiceID, null, null, null, null, "application/pdf")
.then((data) => {
console.log(`data ${JSON.stringify(data)}`);
fs.writeFile(data.FileName, data.PdfContentRaw, 'binary', function(){
// Do something with the file
});
});
@ChrisGrigg
ChrisGrigg / xero.js
Last active September 7, 2017 20:02
function authoriseRedirect(req, res) {
const xeroClient = getXeroClient();
xeroClient.getRequestToken((err, token, secret) => {
if (err) return handleErr(err, res);
console.log('authoriseRedirect token: ' + token);
console.log('authoriseRedirect secret: ' + secret);
req.session.oauthRequestToken = token;
req.session.oauthRequestSecret = secret;
const data = {
authoriseURL: xeroClient.buildAuthorizeUrl(token),