fix(auth): preserve intentional logout across browser return
Keep a bounded per-tab logout intent and broadcast it to already open tabs so back navigation after a normal logout is not mistaken for renewal failure. Preserve real refresh and session expiry signals, and keep IdP navigation reachable when local cleanup fails.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { markIntentionalLogout } from "@/lib/logoutIntent";
|
||||
|
||||
const KEYCLOAK_LOGOUT_PATH = "/api/auth/keycloak-logout";
|
||||
|
||||
type CompleteLogoutOptions = {
|
||||
@@ -41,7 +43,12 @@ export const completeLogout = async ({
|
||||
// Synchronous reporting errors must not block logout either.
|
||||
}
|
||||
|
||||
clearLocalState();
|
||||
markIntentionalLogout();
|
||||
try {
|
||||
clearLocalState();
|
||||
} catch {
|
||||
// Browser storage cleanup failures must not prevent the IdP logout.
|
||||
}
|
||||
navigate(KEYCLOAK_LOGOUT_PATH);
|
||||
return { success: true as const };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user