Skip to content

Commit

Permalink
Merge pull request #27431 from element-hq/t3chguy/fix-oidc-native-ele…
Browse files Browse the repository at this point in the history
…ctron

Fix `element-desktop-ssoid being` included in OIDC Authorization call
  • Loading branch information
t3chguy authored May 13, 2024
2 parents e651330 + 64f0bb5 commit f43bb0a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,9 @@ 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 All @@ -460,4 +457,13 @@ export default class ElectronPlatform extends VectorBasePlatform {
public getOidcClientState(): string {
return `:${SSO_ID_KEY}:${this.ssoID}`;
}

/**
* The URL to return to after a successful OIDC authentication
*/
public getOidcCallbackUrl(): URL {
const url = super.getOidcCallbackUrl();
url.protocol = "io.element.desktop";
return url;
}
}

0 comments on commit f43bb0a

Please sign in to comment.