From af299ec5e46d89966faeb92e52dc04a5277e4716 Mon Sep 17 00:00:00 2001 From: Andrei Shapiro <59471572+shpran@users.noreply.github.com> Date: Thu, 21 Apr 2022 10:35:43 +0300 Subject: [PATCH 1/2] fix: revert - use tokens from store" --- src/core/tokenHandler.js | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/core/tokenHandler.js b/src/core/tokenHandler.js index c14f53e..1d81750 100644 --- a/src/core/tokenHandler.js +++ b/src/core/tokenHandler.js @@ -86,23 +86,25 @@ export default function tokenHandlerFactory(options) { return tokenStore .expireOldTokens() .then(() => { - 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.')); - }); + 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.')); + } + }); + } }); }, From c61e3ea0efbe4bb6f3dc05e4d36b1c9af6c6e54f Mon Sep 17 00:00:00 2001 From: jsconan Date: Thu, 21 Apr 2022 09:58:43 +0200 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 16a9aad..852ad39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@oat-sa/tao-core-sdk", - "version": "1.18.1", + "version": "1.18.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a70e77a..6429fc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oat-sa/tao-core-sdk", - "version": "1.18.1", + "version": "1.18.2", "displayName": "TAO Core SDK", "description": "Core libraries of TAO", "homepage": "https://github.com/oat-sa/tao-core-sdk-fe#readme",