Skip to content

Commit

Permalink
Improve Element Desktop OIDC Native dynamic registration
Browse files Browse the repository at this point in the history
To strip the element-desktop-ssoid param from the redirectUri

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Mar 1, 2024
1 parent f8a2e41 commit 16f197e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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",
};
Expand Down

0 comments on commit 16f197e

Please sign in to comment.