From 1bed54e5b3fa3c530a9ab6b67e186a64b0862ece Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Thu, 28 Sep 2023 17:41:14 +1000 Subject: [PATCH] fixes for autoload multi-issuer --- src/client/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/index.ts b/src/client/index.ts index 3705eb68..a8d3dc43 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -133,6 +133,8 @@ export class Client { this.config = this.mergeConfig(defaultConfig, config) + this.config.autoLoadTokens = localStorage.getItem('tn-autoload-tokens') === 'false' ? false : this.config.autoLoadTokens + this.tokenStore = new TokenStore(this.config.autoEnableTokens, this.config.tokenPersistenceTTL) // @ts-ignore if (this.config.issuers?.length > 0) this.tokenStore.updateIssuers(this.config.issuers) @@ -517,6 +519,7 @@ export class Client { cancelTokenAutoload() { this.cancelAutoload = true + localStorage.setItem('tn-autoload-tokens', 'false') } async setPassiveNegotiationWebTokens(): Promise { @@ -759,6 +762,7 @@ export class Client { this.enableTokenAutoLoadCancel() if (this.config.uiOptions?.userCancelIssuerAutoRedirectTimer) await sleep(this.config.uiOptions.userCancelIssuerAutoRedirectTimer) if (this.userCancelTokenAutoload) { + this.userCancelTokenAutoload = false return {} } const res = await this.messaging.sendMessage( @@ -1004,6 +1008,7 @@ export class Client { .then((cancelAuthButton: HTMLElement) => { cancelAuthButton.onclick = () => { this.userCancelTokenAutoload = true + this.cancelTokenAutoload() this.ui.dismissLoader() } })