Skip to content

Commit

Permalink
Handle redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheberle committed Jun 24, 2024
1 parent 856f91d commit afae9f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions teams-directory/assets/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ async function initGraphClient(tenantid, clientId) {
'user.read.all'
];
const msalClient = await initMsalClient(tenantid, clientId);

// try to get account from cache
const authResult = await msalClient.acquireTokenSilent({
scopes: scopes,
});

// get account from redirect
const authResult = await msalClient.handleRedirectPromise();

// redirect to get account
if (!authResult.account) {
if (authResult === null) {
authProvider.acquireTokenRedirect({
scopes: scopes,
})
}

// set up auth provider
const authProvider = new AuthCodeMSALBrowserAuthenticationProvider(msalClient, {
account: authResult.account,
interactionType: InteractionType.Redirect,
Expand Down

0 comments on commit afae9f8

Please sign in to comment.