Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of old "msal." entires in local storage #527

Closed
2 of 11 tasks
dwatty opened this issue Jan 6, 2019 · 6 comments
Closed
2 of 11 tasks

Lots of old "msal." entires in local storage #527

dwatty opened this issue Jan 6, 2019 · 6 comments
Assignees
Labels
bug A problem that needs to be fixed for the feature to function as intended.
Milestone

Comments

@dwatty
Copy link

dwatty commented Jan 6, 2019

I'm submitting a...

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Performance issue
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Browser:

  • Chrome version 71.0.3578.98
  • Firefox version XX
  • IE version XX
  • Edge version XX
  • Safari version XX

Library version

Library version: 0.2.3

Current behavior

If the user is never logged out and they continue to use the webapp long enough to have the iFrame renew the token, a new entry appears to be added to local storage and no entries are ever being cleaned up. In the event that the user stays logged in for several days, the local storage begins to really fill up with old entries.

My current localhost session has 171 entries for msal.acquireTokenUser and a new one is added every time acquireTokenSilent is called with an expired token and it makes a request for a new token. Of those 171, only 5 of them have actual values - the rest have blank values.

I also see entries for msal.token.renew.status and msal.authority piling up in my local storage as well.

I've run across issues which describe what I'm seeing, but based on the comments in those tickets this sounds like it would have already been resolved.

#327
#370

In reviewing the logout behavior, I noticed these entries aren't cleared from the local storage even when logout is called. The resetCacheItems function in here is only looking for two keys to clear, and it's not actually removing them in most cases, just emptying the value.

Expected behavior

The msal library should be cleaning up the local storage and only keeping around what it needs.

@navyasric navyasric added the bug A problem that needs to be fixed for the feature to function as intended. label Jan 15, 2019
@abhisheksoni27
Copy link

We are using this library in an internal project (soon to be publicly released) and would appreciate if this issue is resolved.

I'd be happy to help out, if needed.

@freeman-g
Copy link

We are having this same issue, so we added a bit of cleanup code until this is fixed in the published MSAL package.

  Object.keys(window.localStorage).forEach(function (key) {
    if (key.startsWith('msal.acquireTokenUser') || key.startsWith('msal.token.renew')) {
      window.localStorage.removeItem(key)
    }
  })

We're running this code everytime we renew the tokens.

@navyasric navyasric added the core label Apr 10, 2019
@sameerag sameerag added this to the 1.0.0 milestone Apr 30, 2019
@sameerag
Copy link
Member

@dwatty This fix is in progress.

@pkanher617
Copy link
Contributor

pkanher617 commented May 3, 2019

@dwatty @freeman-g We have updated the dev branch with changes to fix this. We will be releasing another preview version of the library with these changes in npm by the end of the day. We will also be releasing the 1.0.0 version of the library soon as well, so please be on the lookout for that as well. If you see any other issues relating to msal cache cleanup in new versions of the code please reopen this issue.

@Mathijs003
Copy link

I'm still facing this issue with msal version 1.3.0

@jasonnutter
Copy link
Contributor

@Mathijs003 Please open a new issue, thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A problem that needs to be fixed for the feature to function as intended.
Projects
None yet
Development

No branches or pull requests

8 participants