ac-node-hipchat
Advanced tools
Comparing version
@@ -60,22 +60,2 @@ var _ = require('lodash'); | ||
if (scopes.length === 0) { | ||
throw new Error('At least one scope is required when genereating a token'); | ||
} | ||
self._ensureScopes(scopes); | ||
var cacheKey = (scopes || []).join('|'); | ||
return self._cache.get(cacheKey).then(function (tokenData) { | ||
if (tokenData) return tokenData; | ||
var tokenUrl = self._tenant.links.token; | ||
var username = self._tenant.id; | ||
var password = self._tenant.secret; | ||
return self._client.generateToken(tokenUrl, username, password, scopes); | ||
}).then(function (tokenData) { | ||
return self._cache.set(cacheKey, tokenData, tokenData.expires_in - 60).then(function () { | ||
return tokenData.access_token; | ||
}); | ||
}); | ||
}; | ||
TenantClient.prototype.getToken = function () { | ||
var self = this; | ||
var scopes = [].slice.call(arguments); | ||
if (scopes.length === 0) { | ||
throw new Error('At least one scope is required when generating a token'); | ||
@@ -82,0 +62,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "A common module plugin for building Atlassian Connect add-ons for HipChat", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"author": "Atlassian (http://atlassian.com)", | ||
@@ -17,3 +17,3 @@ "license": "Apache 2.0", | ||
"dependencies": { | ||
"ac-node": "^0.1.2", | ||
"ac-node": "^0.2.0", | ||
"check-types": "^1.3.1", | ||
@@ -20,0 +20,0 @@ "clone": "^0.1.17", |
77262
-0.99%2217
-0.89%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
Updated