react-aad icon indicating copy to clipboard operation
react-aad copied to clipboard

Amass of msal tokens at localStorage and cookies

Open ViieeS opened this issue 5 years ago • 0 comments
trafficstars

Library versions

  • react-aad-msal: 1.1.3
  • msal: 2.3.5

Describe the bug If application works during long period of time tokens start amass at localStorage and cookies (I already have about 100 tokens). Looks like some issue with connection and sleep mode on a laptop, but I'm not sure...

Expected behavior There should be only latest tokens in the cache.

Code snippet

// PII - Personally Identifiable Information
const isPiiLoggingEnabled = NODE_ENV !== 'production';

const logger = new Logger(
  (logLevel, message, containsPii) => {
    console.log("[MSAL]", message);
  },
  {
    level: LogLevel.Verbose,
    piiLoggingEnabled: isPiiLoggingEnabled
  }
);

export const authProvider = new MsalAuthProvider(
  {
    auth: {
      clientId,
      authority: 'https://login.microsoftonline.com/<some-id>',
      redirectUri: ssoRedirectUri
    },
    cache: {
      cacheLocation: 'localStorage',
      storeAuthStateInCookie: true
    },
    system: {
      tokenRenewalOffsetSeconds: 300,
      logger
    }
  },
  {
    scopes: ['https://graph.microsoft.com/User.Read']
  },
  {
    loginType: LoginType.Redirect,
    tokenRefreshUri: ssoRefreshUri
  }
);

Desktop (please complete the following information):

  • OS: macOS, Windows
  • Browser chrome
  • Version 84+

ViieeS avatar Jul 30 '20 14:07 ViieeS