mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-04-19 04:48:59 +01:00
Fix URI for logout and other minor fix
This commit is contained in:
@@ -67,13 +67,11 @@ export async function getMsalInstance() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "development") {
|
|
||||||
msalConfig.auth.redirectUri = "https://dataexplorer-dev.azurewebsites.net/redirectBridge.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
const msalInstance = new msal.PublicClientApplication(msalConfig);
|
const msalInstance = new msal.PublicClientApplication(msalConfig);
|
||||||
// v3+ requires explicit initialization before using MSAL APIs
|
// v3+ requires explicit initialization before using MSAL APIs
|
||||||
await msalInstance.initialize();
|
await msalInstance.initialize();
|
||||||
|
// Handle any redirect response (e.g., after logoutRedirect) to clear interaction state
|
||||||
|
await msalInstance.handleRedirectPromise();
|
||||||
return msalInstance;
|
return msalInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,12 @@ export function useAADAuth(config?: ConfigContext): ReturnType {
|
|||||||
}
|
}
|
||||||
setLoggedOut();
|
setLoggedOut();
|
||||||
localStorage.removeItem("cachedTenantId");
|
localStorage.removeItem("cachedTenantId");
|
||||||
msalInstance.logoutRedirect();
|
// Redirect back to the hosted explorer after logout
|
||||||
|
const postLogoutRedirectUri =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? "https://dataexplorer-dev.azurewebsites.net/hostedExplorer.html"
|
||||||
|
: `${window.location.origin}`;
|
||||||
|
msalInstance.logoutRedirect({ postLogoutRedirectUri });
|
||||||
}, [msalInstance]);
|
}, [msalInstance]);
|
||||||
|
|
||||||
const switchTenant = React.useCallback(
|
const switchTenant = React.useCallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user