mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 23:16:56 +00:00
Fetch aad token against tenant's authority (#1004)
This commit is contained in:
parent
8eeda41021
commit
39dd293fc1
@ -56,6 +56,7 @@ export function useAADAuth(): ReturnType {
|
|||||||
});
|
});
|
||||||
setTenantId(response.tenantId);
|
setTenantId(response.tenantId);
|
||||||
setAccount(response.account);
|
setAccount(response.account);
|
||||||
|
localStorage.setItem("cachedTenantId", response.tenantId);
|
||||||
},
|
},
|
||||||
[account, tenantId]
|
[account, tenantId]
|
||||||
);
|
);
|
||||||
|
@ -98,9 +98,11 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
|
|||||||
const msalInstance = getMsalInstance();
|
const msalInstance = getMsalInstance();
|
||||||
const cachedAccount = msalInstance.getAllAccounts()?.[0];
|
const cachedAccount = msalInstance.getAllAccounts()?.[0];
|
||||||
msalInstance.setActiveAccount(cachedAccount);
|
msalInstance.setActiveAccount(cachedAccount);
|
||||||
|
const cachedTenantId = localStorage.getItem("cachedTenantId");
|
||||||
const aadTokenResponse = await msalInstance.acquireTokenSilent({
|
const aadTokenResponse = await msalInstance.acquireTokenSilent({
|
||||||
forceRefresh: true,
|
forceRefresh: true,
|
||||||
scopes: [hrefEndpoint],
|
scopes: [hrefEndpoint],
|
||||||
|
authority: `${configContext.AAD_ENDPOINT}${cachedTenantId}`,
|
||||||
});
|
});
|
||||||
aadToken = aadTokenResponse.accessToken;
|
aadToken = aadTokenResponse.accessToken;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user