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);
|
||||
setAccount(response.account);
|
||||
localStorage.setItem("cachedTenantId", response.tenantId);
|
||||
},
|
||||
[account, tenantId]
|
||||
);
|
||||
|
|
|
@ -98,9 +98,11 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
|
|||
const msalInstance = getMsalInstance();
|
||||
const cachedAccount = msalInstance.getAllAccounts()?.[0];
|
||||
msalInstance.setActiveAccount(cachedAccount);
|
||||
const cachedTenantId = localStorage.getItem("cachedTenantId");
|
||||
const aadTokenResponse = await msalInstance.acquireTokenSilent({
|
||||
forceRefresh: true,
|
||||
scopes: [hrefEndpoint],
|
||||
authority: `${configContext.AAD_ENDPOINT}${cachedTenantId}`,
|
||||
});
|
||||
aadToken = aadTokenResponse.accessToken;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue