OfficeDev / office-js-helpers

[ARCHIVED] A collection of helpers to simplify development of Office Add-ins & Microsoft Teams Tabs
MIT License
126 stars 56 forks source link

Fix dialog/authentication issues for Edge + 365 and Desktop versions of Office #144

Open almgong opened 4 years ago

almgong commented 4 years ago

Fixes #143

This fix is intended to address authentication issues for both Office 365 with Edge and the desktop versions of Office as of the recent 1903 Windows update, paired with the 1907 update of Office.

We found that for the online version of Office apps running on Edge, the taskpane instance of add-ins would believe that it were running in an add-in environment, but the dialog pop-up would determine that it was in a web environment. This mismatch prevents add-ins from communicating with the dialogs they open for authentication, since add-ins would wait for message events, while dialogs would only set an entry in localStorage.

The fix in this PR is to separate the handling of Edge as a special case and to rely solely on localStorage for both the desktop and online versions of Office apps. We decided to do this because we experienced inconsistent message sending behavior on Edge, whereas localStorage had proven to be more stable.

msftclas commented 4 years ago

CLA assistant check
All CLA requirements met.

Rick-Kirkham commented 4 years ago

@almgong While you are waiting for Louis to look at this, I have a question about this part of your description: "...since add-ins would wait for message events, while dialogs would only set an entry in localStorage"

Are you saying that the messageParent API does not work when Edge is the viewer?

almgong commented 4 years ago

@Rick-Kirkham For the line that you quoted, I was referring to the the different ways that the parent add-in and the dialog were listening and sending messages to each other, respectively. The library handles these two operations differently depending on the determined host, and it is critical that this resolved value is the same in multiple windows for the dialog to close and communicate data successfully.

On the Edge/Office clients that we used to test this fix, we found that the call to Office.context.ui.messageParent() did not trigger the event listener that is attached here: https://github.com/OfficeDev/office-js-helpers/blob/master/src/helpers/dialog.ts#L94. However, falling back to the communication method with localStorage that was already in place for IE 11 and Edge worked every time for us. So I would agree with the statement that the messageParent API does not consistently work on Edge.

alaaet commented 4 years ago

@almgong , I'm facing the same issue, but I use the CDN to load the library into the code, do you know how can I get your fix as a compiled JS file(office.helpers(.min).js)?

almgong commented 4 years ago

@alaaet One way would be to clone the forked repository, navigate to the relevant branch vmFixEdgeSupport, and then run yarn build. This will create the compiled JS file(s) that you can use, including office.helpers.min.js.

zliebersbach commented 4 years ago

@lindalu-MSFT Seeing as you were the last committer on this repository, could we please get some information as to the future of this repository? The last responses from Microsoft in issue #143 don't seem to promising...