Skip to content

Commit

Permalink
Fix element-desktop-ssoid being included in OIDC Authorization call
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed May 3, 2024
1 parent 2c8b32d commit b82100e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -446,8 +448,7 @@ 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
const redirectUri = this.getSSOCallbackUrl(true);
return {
...baseMetadata,
applicationType: "native",
Expand Down

0 comments on commit b82100e

Please sign in to comment.