From 50a815c8be04697d702d92a2c8264152e66d42e9 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 11 Sep 2023 11:14:17 +0200 Subject: [PATCH] only fetch the server configuration if it hasn't been fetched before --- .../src/shared/auth/auth-flow.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts b/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts index 251bdea185..f93a592d6a 100644 --- a/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts +++ b/src/Umbraco.Web.UI.Client/src/shared/auth/auth-flow.ts @@ -102,7 +102,7 @@ export class UmbAuthFlow { openIdConnectUrl: string, redirectUri: string, clientId = 'umbraco-back-office', - scope = 'offline_access' + scope = 'offline_access', ) { this.#openIdConnectUrl = openIdConnectUrl; this.#redirectUri = redirectUri; @@ -115,7 +115,7 @@ export class UmbAuthFlow { this.#authorizationHandler = new RedirectRequestHandler( this.#storageBackend, new UmbNoHashQueryStringUtils(), - window.location + window.location, ); // set notifier to deliver responses @@ -156,7 +156,10 @@ export class UmbAuthFlow { */ async setInitialState() { // Ensure there is a connection to the server - await this.fetchServiceConfiguration(); + if (!this.#configuration) { + await this.fetchServiceConfiguration(); + } + const tokenResponseJson = await this.#storageBackend.getItem(TOKEN_RESPONSE_NAME); if (tokenResponseJson) { const response = new TokenResponse(JSON.parse(tokenResponseJson)); @@ -216,7 +219,7 @@ export class UmbAuthFlow { extras: extras, }, undefined, - true + true, ); this.#authorizationHandler.performAuthorizationRequest(this.#configuration, request);