OfficeDev / office-js-helpers

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

Using localForage (indexedDB) instead of localStorage for Edge #132

Closed YannickRe closed 5 years ago

YannickRe commented 5 years ago

Fixes #131 :

Using this helper for authentication in Edge, the authentication window doesn't close (it works for Chrome and IE etc). The workaround that was put in place (using a polling mechanism on "storage") to circumvent issues with postMessage doesn't work anymore in Edge. For some reason, adding the information to localStorage in the popup window doesn't make it available in the main/opener Window of Edge.

I have seen this behaviour with

Microsoft Edge 44.17763.1.0
Microsoft EdgeHTML 18.17763

I fixed this by using IndexedDB instead of localStorage in the workaround, using localForage wrapper. Using localForage minimizes impact on the code base since it exposes IndexedDB with an API similar to localStorage. Known Issue: IndexedDB is not available in Incognito Mode of Edge, which makes localForage fall back to localStorage and there the issue remains.

Not sure who owns this anymore, since a lot of necessary pull requests just don't get merged lately, so I'm tagging all: @casieber, @Zlatkovsky, @sumurthy & @LouMM

YannickRe commented 5 years ago

Of course, after spending days on a workaround, I noticed the workaround for MSAL at https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Known-issues-on-IE-and-Edge-Browser They have the same issue, and with adding everything to the Trusted Site. I'll try to get in a Pull Request to update the readme.