Fix logout for MSAL v5: use clearCache() for app-only sign out

onRedirectNavigate was removed from EndSessionRequest in msal-browser v3+.
clearCache() clears local tokens without redirecting to Microsoft logout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-30 11:14:06 +01:00
parent dbbef4972b
commit 4b4e48be01

View file

@ -182,9 +182,10 @@ function NavBar() {
const { instance, accounts } = useMsal();
const user = accounts[0];
function handleLogout() {
// Sign out from the app only — does not sign out of the Microsoft account
instance.logoutRedirect({ onRedirectNavigate: () => false });
async function handleLogout() {
// Clear local MSAL cache only — does not sign out of the Microsoft account
await instance.clearCache();
window.location.href = '/gsb';
}
return (