Skip to content

Commit

Permalink
fixes for autoload multi-issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Taras authored and Nick Taras committed Sep 28, 2023
1 parent 9ede23d commit 1bed54e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -517,6 +519,7 @@ export class Client {

cancelTokenAutoload() {
this.cancelAutoload = true
localStorage.setItem('tn-autoload-tokens', 'false')
}

async setPassiveNegotiationWebTokens(): Promise<void> {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1004,6 +1008,7 @@ export class Client {
.then((cancelAuthButton: HTMLElement) => {
cancelAuthButton.onclick = () => {
this.userCancelTokenAutoload = true
this.cancelTokenAutoload()
this.ui.dismissLoader()
}
})
Expand Down

0 comments on commit 1bed54e

Please sign in to comment.