title: Authenticating using MSAL.js in azure webapp
body: <p>I have tried implementing MSAL into a webapp I'm developing, but I've run into some issues, especially with IE and Edge.</p>
  
  <p>The first issue arrises in both chrome and IE/Edge. Upon login I get 2 popups. Before the second popup concludes, the program have already called the Graph API and returned data, so why it shows, I do not know. The code is as follows:</p>
  
  <pre><code>function login(){
      clientApplication = clientApplication || new Msal.UserAgentApplication({ClientId}, null, function (errorDes, token, error, tokenType) {});
  
      clientApplication.loginPopup(["user.read files.readwrite.all group.readwrite.all"]).then(function (token) {
          getAccessToken();
      }, function (error) {
          // handle error
      });
  }
  
  function getAccessToken() {
      clientApplication.acquireTokenSilent(["user.read files.readwrite.all group.readwrite.all"]).then(function (token) {
          //Call Graph API and do stuff.
      });
  }
  </code></pre>
  
  <p>Apart from showing 2 popups, this works perfectly in chrome. If I leave out any of this, I will not be authenticated.</p>
  
  <p>Now, the second part is a but more problematic. I have included the polyfill for promises to make it work in IE, but I still encounter something wierd. If I do not disable Protected Mode in IE, both popups open, but the first one redirects to https://{site}.azurewebsites.net/null . The second popup redirects to about:blank. Neither windows closes, as would be expected.</p>
  
  <p>However, if I do disable Protected Mode, as suggested in the MSAL.js documentation for internal testing, I do get authenticated - the popups just doesn't close automatically. This is obviously not a viable solution for a multi-tenant webapp..</p>
  
  <p>Is there something really wrong about my authentication flow, or am I just missing something? Is there any decent documentation of running authentication with MSAL.js in a single page applicaiton?</p>
  
  <p>EDIT: After some digging, I've found that the authflow is also started in the iframe that is used to make the silent calls. Is there any reason the entire page is also loaded in said iframe? It run all my functions that is run when the dom is ready..</p>
  
  <p>It appears as if no calls are silent, but always requires a popup..</p>