Accessing window.open popup from excel online task

2019-08-02 23:44发布

问题:

I am currently debugging some code that was done by past developers. We are using the below code to open a new window to authenticate the user (oAuth2 Flow).

var oAuth2Window = window.open(_embeddedStartUrl, "Authentication", "location=0,status=0,scrollbars=1,resizable=1,height=600,width=450");

After the user logs in successfully, it's trying to access some properties on oAuth2Window but I am getting:

“Access is denied”.

The host names are on different servers.

This is currently happening in Excel Online within a Task Pane.

This was tested some time ago and was working and went to production.

The past week I have seen this issue happening on local and production/live environments.

How could this worked previously? Knowing that you could not access the pop up window from an iframe

回答1:

You won't be able to do this using this method from your different client applications. Instead you need to route you OAuth workflow through the dialog API window.

See this link here Using the Dialog APIs in an authentication flow (near the bottom of the page).