From 83ef9bee29fc928f495ac8356f5c4c79a38d3269 Mon Sep 17 00:00:00 2001 From: Laurent Caouissin Date: Tue, 24 Oct 2023 09:35:15 +0200 Subject: [PATCH] fix: readonly mode --- src/utils/auth/oidcClient.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/auth/oidcClient.js b/src/utils/auth/oidcClient.js index 5f0bf604..77cbbcc3 100644 --- a/src/utils/auth/oidcClient.js +++ b/src/utils/auth/oidcClient.js @@ -31,18 +31,24 @@ export const createOidcClient = async ({ }); const login = async () => { - const { newUrl: redirect_uri } = addParamToUrl({ + let { newUrl: redirect_uri } = addParamToUrl({ url: window.location.href, name: configHashKey, value: configHash, }); + if (window.location.pathname.startsWith(`/${READ_ONLY}`)) { + const { newUrl } = addParamToUrl({ + url: redirect_uri, + name: 'kc_idp_hint', + value: identityProvider, + }); + redirect_uri = newUrl; + } + await userManager.signinRedirect({ redirect_uri, redirectMethod: 'replace', - login_hint: window.location.pathname.startsWith(`/${READ_ONLY}`) - ? identityProvider - : null, }); return new Promise(() => {}); };