Skip to content

Commit 051847d

Browse files
committed
do not initialize timers if no expiration on access token DuendeArchive#534
1 parent 4666c40 commit 051847d

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/AccessTokenEvents.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export class AccessTokenEvents {
2424

2525
this._cancelTimers();
2626

27-
// only register events if there's an access token where we care about expiration
28-
if (container.access_token) {
27+
// only register events if there's an access token and it has an expiration
28+
if (container.access_token && container.expires_in !== undefined) {
2929
let duration = container.expires_in;
3030
Log.debug("access token present, remaining duration:", duration);
3131

‎test/unit/AccessTokenEvents.spec.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ describe("AccessTokenEvents", function () {
102102
assert.isUndefined(accessTokenExpiredTimer.duration);
103103
});
104104

105+
it("should not initialize timers if no expiration on access token", function () {
106+
subject.load({
107+
access_token:"token"
108+
});
109+
110+
assert.isUndefined(accessTokenExpiringTimer.duration);
111+
assert.isUndefined(accessTokenExpiredTimer.duration);
112+
});
105113
});
106114

107115
describe("unload", function () {

0 commit comments

Comments
 (0)