Open LoveSponge opened 3 years ago
@LoveSponge We're aware of this limitation of the current storage options. We are looking into how to support async storage options (e.g. chrome.storage
, IndexedDB, etc). For now, you may need to use the MSAL MemoryStorage
option, and implement your own caching outside MSAL until we are able to provide built-in support for async storage interfaces.
@jasonnutter Thanks for getting back to me.
That's great to know, maybe you could help me with my current issue - i've implemented my own 'localstorage' which basically just points each of the *Item
functions to chrome.storage functions instead... (chrome.storage.sync.{get,set,remove}Item
)
My issue is that it doesn't appear to be setting any values, only getting and removing them? i'm using an implementation that mimics the Chromium Extension Sample but with the aforementioned poxied localStorage object.
When I do the 'SignIn' through chrome.identity.launchWebAuthFlow()
, I can't see that msal is actually setting any localstorage at all? What am I missing?
To be clear on this, the issue i believe this is causing is that no account is ever registered or any tokens set at all, causing the call to msalInstance.handleRedirectPromise(...)
to always return null
.
Thanks in advance, LS
...until we are able to provide built-in support for async storage interfaces.
Any ETA on this please?
@jasonnutter Is there any proper solution or sample code for this issue?
Core Library
MSAL.js v2 (@azure/msal-browser)
Wrapper Library
Not Applicable
Description
In order to make msal play nice with chrome extension in a service worker, the cache location can be 'mocked' by forcing window.localStorage to instead use chrome.storage apis. The problem is that these apis are asynchronous, and there is no way to make the cache location functions work nicely with asynchronous get/set/clear/etc...
Source
External (Customer)