Skip to content

Commit

Permalink
Merge pull request #848 from TokenScript/feature/text-config
Browse files Browse the repository at this point in the history
fixes for autoload multi-issuer
  • Loading branch information
nicktaras committed Sep 28, 2023
2 parents 78dd7cc + 1bed54e commit 4e4ebb1
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 4e4ebb1

Please sign in to comment.