Properly save undefined id tokens from OIDC login (#33345)

* Properly save `undefined` id tokens from OIDC login

* Fix tests

* Fix tests again

* Fix lints
This commit is contained in:
Ginger
2026-05-01 13:31:34 +00:00
committed by GitHub
parent 244a2ca011
commit bd369a5109
3 changed files with 16 additions and 3 deletions
@@ -48,6 +48,13 @@ describe("persist OIDC settings", () => {
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_id_token", idToken);
});
it("should not set idToken in localStorage when idToken is undefined", () => {
persistOidcAuthenticatedSettings(clientId, issuer, undefined);
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_client_id", clientId);
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
expect(localStorage.getItem("mx_oidc_id_token")).toBeFalsy();
});
});
describe("getStoredOidcTokenIssuer()", () => {