BrowserAuthError: popup_window_error: Error opening popup window on @azure/msal-browser 2.16.1

31 Views Asked by At

I have the following situation:

Package: @azure/msal-browser 2.16.1

Code:

try {
  authResult = await installerMsal.loginPopup({
    scopes: ...,
    prompt: 'consent'
  });
} catch (err) {
...

This will fail with the message (expected):

Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access...

Then I would expect another popup to open requiring the multi-factor authentication, but the problem is, the browser is blocking this popup to come:

BrowserAuthError: popup_window_error: Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser. Details: BrowserAuthError: empty_window_error: window.open returned null or undefined window object.
    at BrowserAuthError.AuthError [as constructor] (AuthError.js:27:1)
    at new BrowserAuthError (BrowserAuthError.js:169:1)
    at push../node_modules/@azure/msal-browser/dist/error/BrowserAuthError.js.BrowserAuthError.createPopupWindowError (BrowserAuthError.js:245:1)
    at push../node_modules/@azure/msal-browser/dist/utils/PopupUtils.js.PopupUtils.openPopup (PopupUtils.js:59:35)
    at push../node_modules/@azure/msal-browser/dist/interaction_handler/PopupHandler.js.PopupHandler.initiateAuthRequest (PopupHandler.js:35:1)
    at PopupClient.<anonymous> (PopupClient.js:116:1)
    at step (_tslib.js:75:1)
    at Object.next (_tslib.js:56:45)
    at fulfilled (_tslib.js:46:42)

I have no clue on what can be done here. If the user allows the popup, the flow works fine, but I would want to avoid this action from the user (allowing popups).

0

There are 0 best solutions below