From b82100ede8f1825071f68cd5872f1c7df1b39f0e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 3 May 2024 12:47:40 +0100 Subject: [PATCH] Fix `element-desktop-ssoid being` included in OIDC Authorization call Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/platform/ElectronPlatform.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index 9063fc945d..0ae1f75863 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -377,10 +377,12 @@ export default class ElectronPlatform extends VectorBasePlatform { return this.ipc.call("getAvailableSpellCheckLanguages"); } - public getSSOCallbackUrl(fragmentAfterLogin?: string): URL { - const url = super.getSSOCallbackUrl(fragmentAfterLogin); + public getSSOCallbackUrl(forOidc = false, fragmentAfterLogin?: string): URL { + const url = super.getSSOCallbackUrl(forOidc, fragmentAfterLogin); url.protocol = "element"; - url.searchParams.set(SSO_ID_KEY, this.ssoID); + if (!forOidc) { + url.searchParams.set(SSO_ID_KEY, this.ssoID); + } return url; } @@ -446,8 +448,7 @@ export default class ElectronPlatform extends VectorBasePlatform { public async getOidcClientMetadata(): Promise { const baseMetadata = await super.getOidcClientMetadata(); - const redirectUri = this.getSSOCallbackUrl(); - redirectUri.searchParams.delete(SSO_ID_KEY); // it will be shuttled via the state param instead + const redirectUri = this.getSSOCallbackUrl(true); return { ...baseMetadata, applicationType: "native",