Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 8c5509c

Browse files
committed
check v3 token expiration
1 parent 3cdd766 commit 8c5509c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

initializers/v3client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
var request = require('request');
1313
var _ = require('underscore');
1414
var async = require('async');
15+
var tcAccounts = require('tc-accounts');
1516

1617
/**
1718
* The URL of the V3 API
@@ -63,7 +64,7 @@ function getToken(connection, callback) {
6364
return;
6465
}
6566
// Cached token
66-
if (!_.isUndefined(tokens[connection.authToken])) {
67+
if (!_.isUndefined(tokens[connection.authToken]) && !tcAccounts.isTokenExpired(tokens[connection.authToken])) {
6768
callback(null, tokens[connection.authToken]);
6869
return;
6970
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"validator": "~3.5.0",
4949
"wkhtmltoimage": ">= 0.1.3",
5050
"xml2js": "0.2.x",
51-
"xtend": "2.1.x"
51+
"xtend": "2.1.x",
52+
"tc-accounts": "https://github.com/appirio-tech/accounts-app#dev"
5253
},
5354
"devDependencies": {
5455
"supertest": "0.8.x",

0 commit comments

Comments
 (0)