popup_window_error: Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.

Glenn Sampson 0 Reputation points
2024-08-04T21:42:26.3133333+00:00

Environment

Platform: PC desktop

Host: Excel Web Add-in

Operating System: Windows

Default Browser: EDGE

We are developing an React Excel Web Add-in that uses SSO - specifcally "@azure/msal-browser": "^3.20.0" and "@azure/msal-react": "^2.0.22",

It is a task pane that signs the user in to aquire a token to send to an API in other functions.

It works perfectly on most machines, the task pane loads, user clicks a button "sign in", a standard microsoft window pops up within excel and they follow the steps and a token for the backend is aquired.

Some people can use and develop the app

Others can't and get an error with the loginPopupin.

Edge is the default browser for all users

Popups enabled for all users

Excel throws this error

"Error during sign in: popup_window_error: Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."

And an additional microsoft store alert pops up

Get an app to open this 'about' link

Your PC doesn't have an app that can open this link. Try lloking for a compatible app in the Microsoft Store

Browse Microsoft Store

This is the working code but I dont think the issue is here rather in the excel setup of the individual machines

const signIn = async () => { try { const response = await msalInstance.loginPopup(loginRequest); setAccount(response.account); const tokenResponse = await msalInstance.acquireTokenSilent({ ...backendRequest, account: response.account }); const accessToken = tokenResponse.accessToken; localStorage.setItem("accessToken", accessToken); } catch (error) {setError("Error during sign in: " + error.message); } };

What the working succesful popup normally looks like

Any suggestions please

Thanks

GlennEnvironment

Platform: PC desktop

Host: Excel Web Add-in

Operating System: Windows

Default Browser: EDGE

We are developing an React Excel Web Add-in that uses SSO - specifcally "@azure/msal-browser": "^3.20.0" and "@azure/msal-react": "^2.0.22",

It is a task pane that signs the user in to aquire a token to send to an API in other functions.

It works perfectly on most machines, the task pane loads, user clicks a button "sign in", a standard microsoft window pops up within excel and they follow the steps and a token for the backend is aquired.

Some people can use and develop the app

Others can't and get an error with the loginPopupin.

Edge is the default browser for all users

Popups enabled for all users

Excel throws this error

"Error during sign in: popup_window_error: Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."

And an additional microsoft store alert pops up

***Get an app to open this 'about' link ***

Your PC doesn't have an app that can open this link. Try lloking for a compatible app in the Microsoft Store

Browse Microsoft Store

This is the working code but I dont think the issue is here rather in the excel setup of the individual machines

const signIn = async () => {      
try {        
const response = await msalInstance.loginPopup(loginRequest);        setAccount(response.account); 
const tokenResponse = await msalInstance.acquireTokenSilent({ ...backendRequest, account: response.account});  
const accessToken = tokenResponse.accessToken; localStorage.setItem("accessToken", accessToken);  
} 
catch (error)  
{setError("Error during sign in: " + error.message);      
}    
}; 

What the working succesful popup normally looks like

Any suggestions please

Thanks

Glenn

Microsoft 365 and Office | Development | Office JavaScript API
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.