Skip to content

Commit

Permalink
Merge branch 'release-1.18.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsconan committed Apr 21, 2022
2 parents a8f63a3 + c61e3ea commit dc01801
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 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.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",
Expand Down
36 changes: 19 additions & 17 deletions src/core/tokenHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
}
});
}
});
},

Expand Down

0 comments on commit dc01801

Please sign in to comment.