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>
pull/27102/head
Michael Telatynski 2024-03-01 13:24:44 +00:00
parent f8a2e41df3
commit 16f197eda8
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
1 changed files with 4 additions and 1 deletions

View File

@ -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<OidcRegistrationClientMetadata> {
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",
};