mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 02:11:29 +00:00
Improve Entra ID token acquisition logic (#1940)
* Add a silent parameter to acquireTokenWithMsal If true, the function won't retry to sign in using a Popup if silent token acquisition fails. * Improve Login for Entra ID RBAC button logic Try to reuse an existing signed-in MSAL account to get the AAD token and fall back to full sign-in otherwise. Also move the logic to AuthorizationUtils * Try to acquire an Entra ID token silently on startup. When running in Portal MSAL should be able to reuse the MSAL account from Portal and allow us to silently get the RBAC token. If it fails we'll show the Login for Entry ID RBAC button as usual. * Small code improvements * Remove the RBAC notice from settings pane and try to acquire RBAC token silently after enabling RBAC. * Use msal.ssoSilent with an optional login hint to avoid more sign-in popups. msal.loginPopup will be used as a backup option if ssoSilent fails. Ideally the parent environment (Portal/Fabric) should send a loginHint with the username of the currently signed in user that can be passed to the token acquisition flow. * Improve RBAC error wording, clarifying where to find the Login button.
This commit is contained in:
@@ -27,7 +27,7 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
|
||||
);
|
||||
if (!userContext.aadToken) {
|
||||
logConsoleError(
|
||||
`AAD token does not exist. Please click on "Login for Entra ID" button prior to performing Entra ID RBAC operations`,
|
||||
`AAD token does not exist. Please use the "Login for Entra ID" button in the Toolbar prior to performing Entra ID RBAC operations`,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user