From f68be4a689d5afab05adcb9428e4bfa4940c0bf1 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Tue, 12 Apr 2022 08:17:30 +0000 Subject: [PATCH 1/2] fix: use tokens from store --- src/core/tokenHandler.js | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/core/tokenHandler.js b/src/core/tokenHandler.js index 1d81750..c14f53e 100644 --- a/src/core/tokenHandler.js +++ b/src/core/tokenHandler.js @@ -86,25 +86,23 @@ export default function tokenHandlerFactory(options) { return tokenStore .expireOldTokens() .then(() => { - if (!clientConfigFetched) { - // Client Config allowed! (first and only time) - return this.getClientConfigTokens() - .then(getFirstTokenValue); - } else { - return tokenStore.getSize() - .then(queueSize => { - if (queueSize > 0) { - // Token available, use it - return getFirstTokenValue(); - } else if (!validateTokensOpt) { - return this.getClientConfigTokens() - .then(getFirstTokenValue); - } else { - // No more token options, refresh needed - return Promise.reject(new Error('No tokens available. Please refresh the page.')); - } - }); - } + return tokenStore + .getSize() + .then(queueSize => { + if (queueSize > 0) { + // Token available, use it + return getFirstTokenValue(); + } + + if (!validateTokensOpt || !clientConfigFetched) { + return this + .getClientConfigTokens() + .then(getFirstTokenValue); + } + + // No more token options, refresh needed + return Promise.reject(new Error('No tokens available. Please refresh the page.')); + }); }); }, From 7697fc49cf3f275d9fa2dfdf86fe9f0d095f0764 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro Date: Wed, 13 Apr 2022 09:01:41 +0000 Subject: [PATCH 2/2] chore: bump version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 22052ec..1776356 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@oat-sa/tao-core-sdk", - "version": "1.16.3", + "version": "1.16.3-1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2878a1f..ec5e967 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oat-sa/tao-core-sdk", - "version": "1.16.3", + "version": "1.16.3-1", "displayName": "TAO Core SDK", "description": "Core libraries of TAO", "homepage": "https://github.com/oat-sa/tao-core-sdk-fe#readme",