Skip to content

Commit

Permalink
Merge branch 'release-1.18.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bziondik committed Apr 12, 2022
2 parents addad88 + 8518a73 commit a8f63a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oat-sa/tao-core-sdk",
"version": "1.18.0",
"version": "1.18.1",
"displayName": "TAO Core SDK",
"description": "Core libraries of TAO",
"homepage": "https://github.com/oat-sa/tao-core-sdk-fe#readme",
Expand Down
36 changes: 17 additions & 19 deletions src/core/tokenHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
});
});
},

Expand Down

0 comments on commit a8f63a3

Please sign in to comment.