Allow dynamic MSAL Authority (#896)

This commit is contained in:
Steve Faulkner
2021-06-16 09:13:11 -05:00
committed by GitHub
parent 914c372f5b
commit 6f68c75257
7 changed files with 23 additions and 10 deletions

View File

@@ -51,7 +51,7 @@ export function useAADAuth(): ReturnType {
async (id) => {
const response = await msalInstance.loginPopup({
redirectUri: configContext.msalRedirectURI,
authority: `https://login.microsoftonline.com/${id}`,
authority: `${configContext.AAD_ENDPOINT}${id}`,
scopes: [],
});
setTenantId(response.tenantId);
@@ -64,12 +64,12 @@ export function useAADAuth(): ReturnType {
if (account && tenantId) {
Promise.all([
msalInstance.acquireTokenSilent({
authority: `https://login.microsoftonline.com/${tenantId}`,
scopes: ["https://graph.windows.net//.default"],
authority: `${configContext.AAD_ENDPOINT}${tenantId}`,
scopes: [`${configContext.GRAPH_ENDPOINT}/.default`],
}),
msalInstance.acquireTokenSilent({
authority: `https://login.microsoftonline.com/${tenantId}`,
scopes: ["https://management.azure.com//.default"],
authority: `${configContext.AAD_ENDPOINT}${tenantId}`,
scopes: [`${configContext.ARM_ENDPOINT}/.default`],
}),
]).then(([graphTokenResponse, armTokenResponse]) => {
setGraphToken(graphTokenResponse.accessToken);