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
+1 -1
View File
@@ -86,7 +86,7 @@ type CompleteOidcLoginResponse = {
// refreshToken gained from OIDC token issuer, when falsy token cannot be refreshed
refreshToken?: string;
// idToken gained from OIDC token issuer
idToken: string;
idToken?: string;
// this client's id as registered with the OIDC issuer
clientId: string;
// issuer used during authentication
@@ -25,10 +25,16 @@ const idTokenClaimsStorageKey = "mx_oidc_id_token_claims";
* @param idToken
* @param idTokenClaims
*/
export const persistOidcAuthenticatedSettings = (clientId: string, issuer: string, idToken: string): void => {
export const persistOidcAuthenticatedSettings = (
clientId: string,
issuer: string,
idToken: string | undefined,
): void => {
localStorage.setItem(clientIdStorageKey, clientId);
localStorage.setItem(tokenIssuerStorageKey, issuer);
localStorage.setItem(idTokenStorageKey, idToken);
if (idToken) {
localStorage.setItem(idTokenStorageKey, idToken);
}
};
/**