Skip to content

Commit

Permalink
Merge pull request #27017 from element-hq/t3chguy/oidc-desktop
Browse files Browse the repository at this point in the history
Fix Native OIDC for Element Desktop
  • Loading branch information
t3chguy authored Feb 19, 2024
2 parents 7da5e48 + 88d6340 commit 35fe447
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ interface SquirrelUpdate {
updateURL: string;
}

const SSO_ID_KEY = "element-desktop-ssoid";

const isMac = navigator.platform.toUpperCase().includes("MAC");

function platformFriendlyName(): string {
Expand Down Expand Up @@ -378,7 +380,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
public getSSOCallbackUrl(fragmentAfterLogin: string): URL {
const url = super.getSSOCallbackUrl(fragmentAfterLogin);
url.protocol = "element";
url.searchParams.set("element-desktop-ssoid", this.ssoID);
url.searchParams.set(SSO_ID_KEY, this.ssoID);
return url;
}

Expand Down Expand Up @@ -451,4 +453,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
clientUri: "https://element.io",
};
}

public getOidcClientState(): string {
return `:${SSO_ID_KEY}:${this.ssoID}`;
}
}

0 comments on commit 35fe447

Please sign in to comment.