diff options
author | Ben Burwell <ben@benburwell.com> | 2015-12-14 22:23:28 -0500 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2015-12-14 22:23:28 -0500 |
commit | 25ae4e9c132d6e68ddb389808b8f22c8f43b17cd (patch) | |
tree | f1647f2fa1df50cb5f06dbe8c23d4aa9deac8132 /examples/oauth.js | |
parent | 05337261ffb4abfb0fbbb9c775ccad0e28645692 (diff) |
Begin rewrite for new OAuth API
Diffstat (limited to 'examples/oauth.js')
-rw-r--r-- | examples/oauth.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/oauth.js b/examples/oauth.js new file mode 100644 index 0000000..575d0d0 --- /dev/null +++ b/examples/oauth.js @@ -0,0 +1,16 @@ +var Active911 = require('../'); +var client = new Active911.RefreshClient('YOUR REFRESH TOKEN'); + +client.getAgency().then(function(agency) { + console.log(agency.name); + agency.devices.forEach(function(deviceInfo) { + client.getDevice(deviceInfo.id).then(function(device) { + console.log(device.name); + }).catch(function(err) { + console.log('Error retrieving device info for #' + deviceInfo.id); + }); + }); +}).catch(function(err) { + console.log('Error retrieving agency info:', err); +}); + |