Skip to content

Commit

Permalink
TBD-48 fix: decrease a priority of !validateTokensOpt condition whe…
Browse files Browse the repository at this point in the history
…n retrieving a CSRF token
  • Loading branch information
wazelin committed Aug 7, 2020
1 parent 2553913 commit eafcdd3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/tokenHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ export default function tokenHandlerFactory(options) {
return tokenStore
.expireOldTokens()
.then(() => {
if (!validateTokensOpt) {
return this.getClientConfigTokens()
.then(getFirstTokenValue);
} else if (!clientConfigFetched) {
if (!clientConfigFetched) {
// Client Config allowed! (first and only time)
return this.getClientConfigTokens()
.then(getFirstTokenValue);
Expand All @@ -99,6 +96,9 @@ export default function tokenHandlerFactory(options) {
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 eafcdd3

Please sign in to comment.