From 16f197eda8e41eaa0d6d4be071f5cc2cd18199ef Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 1 Mar 2024 13:24:44 +0000 Subject: [PATCH] Improve Element Desktop OIDC Native dynamic registration To strip the element-desktop-ssoid param from the redirectUri Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/platform/ElectronPlatform.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index fa776c4ccb..fdb46bb0eb 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -377,7 +377,7 @@ export default class ElectronPlatform extends VectorBasePlatform { return this.ipc.call("getAvailableSpellCheckLanguages"); } - public getSSOCallbackUrl(fragmentAfterLogin: string): URL { + public getSSOCallbackUrl(fragmentAfterLogin?: string): URL { const url = super.getSSOCallbackUrl(fragmentAfterLogin); url.protocol = "element"; url.searchParams.set(SSO_ID_KEY, this.ssoID); @@ -446,9 +446,12 @@ 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 return { ...baseMetadata, applicationType: "native", + redirectUris: [redirectUri.href], // XXX: This should be overridable in config clientUri: "https://element.io", };