fix(auth): await OAuth storage load() to fix remote OAuth races

This commit is contained in:
Bob Dickinson 2026-07-03 14:18:00 -07:00
commit a24091484c

View file

@ -21,10 +21,13 @@ export async function getEmaIdpLoginState(
return "expired";
}
export function clearEmaIdpSession(storage: OAuthStorage, issuer: string): void {
export async function clearEmaIdpSession(
storage: OAuthStorage,
issuer: string,
): Promise<void> {
const normalized = normalizeIdpIssuer(issuer);
if (!normalized) return;
storage.clearIdpSession(normalized);
storage.clear(idpOAuthStorageKey(normalized));
storage.clearEnterpriseManagedResourceServers();
await storage.clearIdpSession(normalized);
await storage.clear(idpOAuthStorageKey(normalized));
await storage.clearEnterpriseManagedResourceServers();
}