0

I am developing an Excel Addin that uses the MSAL to perform SSO on behalf of the logged in user. Given that the user is running the Addin from O365 cloud they are already signed into the domain, and the login should be silent. However, I am noting a brief popup following the SSO flow. Currently the redirect URL in MS Entra ID is set to the Excel Addin web page. I had tried configuring the following https://login.microsoftonline.com/common/oauth2/nativeclient - however am getting a blank page popup.

Any thoughts on appropriate redirect URL will be gratefully received.

Login code per below:

async function signIn(msalConfig, scopeArray) {
      if (msalClient == null){
        msalClient = new msal.PublicClientApplication(msalConfig);
      }

      if ( msalRequest.scopes.length == 0 ){
        msalRequest.scopes = JSON.parse(JSON.stringify(scopeArray));
      }

      // Use MSAL to login
      let authResult = null;
      const account = msalClient.getActiveAccount();

      if ( account !== null ){
        authResult = await msalClient.acquireTokenSilent({account: account});
        traceLog(`signIn`, `Reusing ${account.username} ${account.name}`);
      } else {
        authResult = await msalClient.loginPopup(msalRequest);
      }
  
      msalClient.setActiveAccount(authResult.account);
  }

1 Answer 1

0

Simplest solution seems to be to create a dedicated redirect page that closes the popup:

<html><head></head><body><script>window.close()</script></body></html>

Not the answer you're looking for? Browse other questions tagged or ask your own question.