Skip to content

Instantly share code, notes, and snippets.

@mwoodbri
Created June 1, 2016 12:51
Show Gist options
  • Save mwoodbri/49488d846ac6930f48214bd6e391c648 to your computer and use it in GitHub Desktop.
Save mwoodbri/49488d846ac6930f48214bd6e391c648 to your computer and use it in GitHub Desktop.
xero-quickstart
var consumer_key = '...';
var request = require('request').defaults({
oauth: {
consumer_key: consumer_key,
token: consumer_key,
signature_method : 'RSA-SHA1',
private_key: require('fs').readFileSync('privatekey.pem')
},
json: true
});
request('https://api.xero.com/api.xro/2.0/Organisation', function(e, r, organisation) {
console.log(e || organisation);
});
{
"name": "xero-quickstart",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"request": "^2.72.0"
}
}
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment