@azure/msal-browser 3.28.1 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AccountManager.d.ts +7 -7
  7. package/dist/cache/AccountManager.d.ts.map +1 -1
  8. package/dist/cache/AccountManager.mjs +17 -15
  9. package/dist/cache/AccountManager.mjs.map +1 -1
  10. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  11. package/dist/cache/BrowserCacheManager.d.ts +35 -27
  12. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  13. package/dist/cache/BrowserCacheManager.mjs +187 -91
  14. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  15. package/dist/cache/BrowserStorage.mjs +1 -1
  16. package/dist/cache/CookieStorage.mjs +1 -1
  17. package/dist/cache/DatabaseStorage.mjs +1 -1
  18. package/dist/cache/LocalStorage.mjs +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/SessionStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.d.ts.map +1 -1
  22. package/dist/cache/TokenCache.mjs +16 -15
  23. package/dist/cache/TokenCache.mjs.map +1 -1
  24. package/dist/config/Configuration.mjs +1 -1
  25. package/dist/controllers/ControllerFactory.mjs +1 -1
  26. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
  27. package/dist/controllers/NestedAppAuthController.mjs +28 -18
  28. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  29. package/dist/controllers/StandardController.d.ts.map +1 -1
  30. package/dist/controllers/StandardController.mjs +16 -9
  31. package/dist/controllers/StandardController.mjs.map +1 -1
  32. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  33. package/dist/crypto/BrowserCrypto.mjs +1 -1
  34. package/dist/crypto/CryptoOps.mjs +1 -1
  35. package/dist/crypto/PkceGenerator.mjs +1 -1
  36. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  37. package/dist/encode/Base64Decode.mjs +1 -1
  38. package/dist/encode/Base64Encode.mjs +1 -1
  39. package/dist/error/BrowserAuthError.mjs +1 -1
  40. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  41. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  42. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  43. package/dist/error/NativeAuthError.mjs +1 -1
  44. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  45. package/dist/error/NestedAppAuthError.mjs +1 -1
  46. package/dist/event/EventHandler.mjs +1 -1
  47. package/dist/event/EventMessage.mjs +1 -1
  48. package/dist/event/EventType.mjs +1 -1
  49. package/dist/index.mjs +1 -1
  50. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  51. package/dist/interaction_client/BaseInteractionClient.mjs +5 -5
  52. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  53. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  54. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  55. package/dist/interaction_client/NativeInteractionClient.mjs +9 -7
  56. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  57. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  58. package/dist/interaction_client/PopupClient.mjs +2 -2
  59. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  60. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  61. package/dist/interaction_client/RedirectClient.mjs +2 -2
  62. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  63. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  64. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  65. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  66. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  67. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  68. package/dist/interaction_client/StandardInteractionClient.mjs +3 -2
  69. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  70. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  71. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  72. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  73. package/dist/naa/BridgeError.mjs +1 -1
  74. package/dist/naa/BridgeProxy.mjs +1 -1
  75. package/dist/naa/BridgeStatusCode.mjs +1 -1
  76. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  77. package/dist/navigation/NavigationClient.mjs +1 -1
  78. package/dist/network/FetchClient.mjs +1 -1
  79. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  80. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  81. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  82. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  83. package/dist/packageMetadata.d.ts +1 -1
  84. package/dist/packageMetadata.mjs +2 -2
  85. package/dist/request/RequestHelpers.mjs +1 -1
  86. package/dist/response/ResponseHandler.mjs +1 -1
  87. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  88. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  89. package/dist/utils/BrowserConstants.d.ts +1 -0
  90. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  91. package/dist/utils/BrowserConstants.mjs +2 -1
  92. package/dist/utils/BrowserConstants.mjs.map +1 -1
  93. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  94. package/dist/utils/BrowserUtils.mjs +1 -1
  95. package/lib/msal-browser.cjs +464 -343
  96. package/lib/msal-browser.cjs.map +1 -1
  97. package/lib/msal-browser.js +464 -343
  98. package/lib/msal-browser.js.map +1 -1
  99. package/lib/msal-browser.min.js +65 -66
  100. package/lib/types/cache/AccountManager.d.ts +7 -7
  101. package/lib/types/cache/AccountManager.d.ts.map +1 -1
  102. package/lib/types/cache/BrowserCacheManager.d.ts +35 -27
  103. package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
  104. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  105. package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  106. package/lib/types/controllers/StandardController.d.ts.map +1 -1
  107. package/lib/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  108. package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  109. package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
  110. package/lib/types/interaction_client/RedirectClient.d.ts.map +1 -1
  111. package/lib/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  112. package/lib/types/packageMetadata.d.ts +1 -1
  113. package/lib/types/utils/BrowserConstants.d.ts +1 -0
  114. package/lib/types/utils/BrowserConstants.d.ts.map +1 -1
  115. package/package.json +3 -3
  116. package/src/cache/AccountManager.ts +40 -20
  117. package/src/cache/BrowserCacheManager.ts +332 -109
  118. package/src/cache/TokenCache.ts +25 -11
  119. package/src/controllers/NestedAppAuthController.ts +51 -18
  120. package/src/controllers/StandardController.ts +26 -7
  121. package/src/interaction_client/BaseInteractionClient.ts +5 -4
  122. package/src/interaction_client/NativeInteractionClient.ts +22 -12
  123. package/src/interaction_client/PopupClient.ts +2 -1
  124. package/src/interaction_client/RedirectClient.ts +2 -1
  125. package/src/interaction_client/StandardInteractionClient.ts +2 -1
  126. package/src/packageMetadata.ts +1 -1
  127. package/src/utils/BrowserConstants.ts +1 -0
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v3.28.1 2025-01-14 */
1
+ /*! @azure/msal-browser v3.30.0 2025-08-05 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v14.16.0 2025-01-14 */
5
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -312,7 +312,7 @@ const JsonWebTokenTypes = {
312
312
  // Token renewal offset default in seconds
313
313
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
314
314
 
315
- /*! @azure/msal-common v14.16.0 2025-01-14 */
315
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
316
316
  /*
317
317
  * Copyright (c) Microsoft Corporation. All rights reserved.
318
318
  * Licensed under the MIT License.
@@ -329,7 +329,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
329
329
  unexpectedError: unexpectedError
330
330
  });
331
331
 
332
- /*! @azure/msal-common v14.16.0 2025-01-14 */
332
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
333
333
 
334
334
  /*
335
335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -378,7 +378,7 @@ function createAuthError(code, additionalMessage) {
378
378
  : AuthErrorMessages[code]);
379
379
  }
380
380
 
381
- /*! @azure/msal-common v14.16.0 2025-01-14 */
381
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
382
382
  /*
383
383
  * Copyright (c) Microsoft Corporation. All rights reserved.
384
384
  * Licensed under the MIT License.
@@ -476,7 +476,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
476
476
  userTimeoutReached: userTimeoutReached
477
477
  });
478
478
 
479
- /*! @azure/msal-common v14.16.0 2025-01-14 */
479
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
480
480
 
481
481
  /*
482
482
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -728,7 +728,7 @@ function createClientAuthError(errorCode, additionalMessage) {
728
728
  return new ClientAuthError(errorCode, additionalMessage);
729
729
  }
730
730
 
731
- /*! @azure/msal-common v14.16.0 2025-01-14 */
731
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
732
732
 
733
733
  /*
734
734
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -767,7 +767,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
767
767
  },
768
768
  };
769
769
 
770
- /*! @azure/msal-common v14.16.0 2025-01-14 */
770
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
771
771
 
772
772
  /*
773
773
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -958,12 +958,12 @@ class Logger {
958
958
  }
959
959
  }
960
960
 
961
- /*! @azure/msal-common v14.16.0 2025-01-14 */
961
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
962
962
  /* eslint-disable header/header */
963
963
  const name$1 = "@azure/msal-common";
964
- const version$1 = "14.16.0";
964
+ const version$1 = "14.16.1";
965
965
 
966
- /*! @azure/msal-common v14.16.0 2025-01-14 */
966
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
967
967
  /*
968
968
  * Copyright (c) Microsoft Corporation. All rights reserved.
969
969
  * Licensed under the MIT License.
@@ -983,7 +983,7 @@ const AzureCloudInstance = {
983
983
  AzureUsGovernment: "https://login.microsoftonline.us",
984
984
  };
985
985
 
986
- /*! @azure/msal-common v14.16.0 2025-01-14 */
986
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
987
987
 
988
988
  /*
989
989
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1044,7 +1044,7 @@ function checkMaxAge(authTime, maxAge) {
1044
1044
  }
1045
1045
  }
1046
1046
 
1047
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1047
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1048
1048
  /*
1049
1049
  * Copyright (c) Microsoft Corporation. All rights reserved.
1050
1050
  * Licensed under the MIT License.
@@ -1081,7 +1081,7 @@ function wasClockTurnedBack(cachedAt) {
1081
1081
  return cachedAtSec > nowSeconds();
1082
1082
  }
1083
1083
 
1084
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1084
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1085
1085
 
1086
1086
  /*
1087
1087
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1408,7 +1408,7 @@ function isAuthorityMetadataExpired(metadata) {
1408
1408
  return metadata.expiresAt <= nowSeconds();
1409
1409
  }
1410
1410
 
1411
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1411
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1412
1412
  /*
1413
1413
  * Copyright (c) Microsoft Corporation. All rights reserved.
1414
1414
  * Licensed under the MIT License.
@@ -1462,7 +1462,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1462
1462
  urlParseError: urlParseError
1463
1463
  });
1464
1464
 
1465
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1465
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1466
1466
 
1467
1467
  /*
1468
1468
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1600,7 +1600,7 @@ function createClientConfigurationError(errorCode) {
1600
1600
  return new ClientConfigurationError(errorCode);
1601
1601
  }
1602
1602
 
1603
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1603
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1604
1604
  /*
1605
1605
  * Copyright (c) Microsoft Corporation. All rights reserved.
1606
1606
  * Licensed under the MIT License.
@@ -1697,7 +1697,7 @@ class StringUtils {
1697
1697
  }
1698
1698
  }
1699
1699
 
1700
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1700
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1701
1701
 
1702
1702
  /*
1703
1703
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1897,7 +1897,7 @@ class ScopeSet {
1897
1897
  }
1898
1898
  }
1899
1899
 
1900
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1900
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1901
1901
 
1902
1902
  /*
1903
1903
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1937,7 +1937,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
1937
1937
  };
1938
1938
  }
1939
1939
 
1940
- /*! @azure/msal-common v14.16.0 2025-01-14 */
1940
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
1941
1941
  /*
1942
1942
  * Copyright (c) Microsoft Corporation. All rights reserved.
1943
1943
  * Licensed under the MIT License.
@@ -2016,7 +2016,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2016
2016
  return updatedAccountInfo;
2017
2017
  }
2018
2018
 
2019
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2019
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2020
2020
  /*
2021
2021
  * Copyright (c) Microsoft Corporation. All rights reserved.
2022
2022
  * Licensed under the MIT License.
@@ -2031,7 +2031,7 @@ const AuthorityType = {
2031
2031
  Ciam: 3,
2032
2032
  };
2033
2033
 
2034
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2034
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2035
2035
  /*
2036
2036
  * Copyright (c) Microsoft Corporation. All rights reserved.
2037
2037
  * Licensed under the MIT License.
@@ -2053,7 +2053,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2053
2053
  return null;
2054
2054
  }
2055
2055
 
2056
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2056
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2057
2057
  /*
2058
2058
  * Copyright (c) Microsoft Corporation. All rights reserved.
2059
2059
  * Licensed under the MIT License.
@@ -2066,7 +2066,7 @@ const ProtocolMode = {
2066
2066
  OIDC: "OIDC",
2067
2067
  };
2068
2068
 
2069
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2069
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2070
2070
 
2071
2071
  /*
2072
2072
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2309,7 +2309,7 @@ class AccountEntity {
2309
2309
  }
2310
2310
  }
2311
2311
 
2312
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2312
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2313
2313
 
2314
2314
  /*
2315
2315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2356,7 +2356,7 @@ function getDeserializedResponse(responseString) {
2356
2356
  return null;
2357
2357
  }
2358
2358
 
2359
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2359
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2360
2360
 
2361
2361
  /*
2362
2362
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2520,7 +2520,7 @@ class UrlString {
2520
2520
  }
2521
2521
  }
2522
2522
 
2523
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2523
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2524
2524
 
2525
2525
  /*
2526
2526
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2660,23 +2660,23 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2660
2660
  return null;
2661
2661
  }
2662
2662
 
2663
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2663
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2664
2664
  /*
2665
2665
  * Copyright (c) Microsoft Corporation. All rights reserved.
2666
2666
  * Licensed under the MIT License.
2667
2667
  */
2668
- const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2669
- const cacheUnknownErrorCode = "cache_error_unknown";
2668
+ const cacheQuotaExceeded = "cache_quota_exceeded";
2669
+ const cacheErrorUnknown = "cache_error_unknown";
2670
2670
 
2671
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2671
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2672
2672
 
2673
2673
  /*
2674
2674
  * Copyright (c) Microsoft Corporation. All rights reserved.
2675
2675
  * Licensed under the MIT License.
2676
2676
  */
2677
2677
  const CacheErrorMessages = {
2678
- [cacheQuotaExceededErrorCode]: "Exceeded cache storage capacity.",
2679
- [cacheUnknownErrorCode]: "Unexpected error occurred when using cache storage.",
2678
+ [cacheQuotaExceeded]: "Exceeded cache storage capacity.",
2679
+ [cacheErrorUnknown]: "Unexpected error occurred when using cache storage.",
2680
2680
  };
2681
2681
  /**
2682
2682
  * Error thrown when there is an error with the cache
@@ -2686,16 +2686,34 @@ class CacheError extends Error {
2686
2686
  const message = errorMessage ||
2687
2687
  (CacheErrorMessages[errorCode]
2688
2688
  ? CacheErrorMessages[errorCode]
2689
- : CacheErrorMessages[cacheUnknownErrorCode]);
2689
+ : CacheErrorMessages[cacheErrorUnknown]);
2690
2690
  super(`${errorCode}: ${message}`);
2691
2691
  Object.setPrototypeOf(this, CacheError.prototype);
2692
2692
  this.name = "CacheError";
2693
2693
  this.errorCode = errorCode;
2694
2694
  this.errorMessage = message;
2695
2695
  }
2696
+ }
2697
+ /**
2698
+ * Helper function to wrap browser errors in a CacheError object
2699
+ * @param e
2700
+ * @returns
2701
+ */
2702
+ function createCacheError(e) {
2703
+ if (!(e instanceof Error)) {
2704
+ return new CacheError(cacheErrorUnknown);
2705
+ }
2706
+ if (e.name === "QuotaExceededError" ||
2707
+ e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
2708
+ e.message.includes("exceeded the quota")) {
2709
+ return new CacheError(cacheQuotaExceeded);
2710
+ }
2711
+ else {
2712
+ return new CacheError(e.name, e.message);
2713
+ }
2696
2714
  }
2697
2715
 
2698
- /*! @azure/msal-common v14.16.0 2025-01-14 */
2716
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
2699
2717
 
2700
2718
  /*
2701
2719
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2717,14 +2735,14 @@ class CacheManager {
2717
2735
  * @param accountFilter - (Optional) filter to narrow down the accounts returned
2718
2736
  * @returns Array of AccountInfo objects in cache
2719
2737
  */
2720
- getAllAccounts(accountFilter) {
2721
- return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter || {}), accountFilter);
2738
+ getAllAccounts(correlationId, accountFilter) {
2739
+ return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter || {}, correlationId), correlationId, accountFilter);
2722
2740
  }
2723
2741
  /**
2724
2742
  * Gets first tenanted AccountInfo object found based on provided filters
2725
2743
  */
2726
- getAccountInfoFilteredBy(accountFilter) {
2727
- const allAccounts = this.getAllAccounts(accountFilter);
2744
+ getAccountInfoFilteredBy(accountFilter, correlationId) {
2745
+ const allAccounts = this.getAllAccounts(correlationId, accountFilter);
2728
2746
  if (allAccounts.length > 1) {
2729
2747
  // If one or more accounts are found, prioritize accounts that have an ID token
2730
2748
  const sortedAccounts = allAccounts.sort((account) => {
@@ -2745,8 +2763,8 @@ class CacheManager {
2745
2763
  * @param accountFilter
2746
2764
  * @returns
2747
2765
  */
2748
- getBaseAccountInfo(accountFilter) {
2749
- const accountEntities = this.getAccountsFilteredBy(accountFilter);
2766
+ getBaseAccountInfo(accountFilter, correlationId) {
2767
+ const accountEntities = this.getAccountsFilteredBy(accountFilter, correlationId);
2750
2768
  if (accountEntities.length > 0) {
2751
2769
  return accountEntities[0].getAccountInfo();
2752
2770
  }
@@ -2761,12 +2779,12 @@ class CacheManager {
2761
2779
  * @param accountFilter
2762
2780
  * @returns Array of AccountInfo objects that match account and tenant profile filters
2763
2781
  */
2764
- buildTenantProfiles(cachedAccounts, accountFilter) {
2782
+ buildTenantProfiles(cachedAccounts, correlationId, accountFilter) {
2765
2783
  return cachedAccounts.flatMap((accountEntity) => {
2766
- return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);
2784
+ return this.getTenantProfilesFromAccountEntity(accountEntity, correlationId, accountFilter?.tenantId, accountFilter);
2767
2785
  });
2768
2786
  }
2769
- getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter) {
2787
+ getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter) {
2770
2788
  let tenantedAccountInfo = null;
2771
2789
  let idTokenClaims;
2772
2790
  if (tenantProfileFilter) {
@@ -2774,7 +2792,7 @@ class CacheManager {
2774
2792
  return null;
2775
2793
  }
2776
2794
  }
2777
- const idToken = this.getIdToken(accountInfo, tokenKeys, tenantProfile.tenantId);
2795
+ const idToken = this.getIdToken(accountInfo, correlationId, tokenKeys, tenantProfile.tenantId);
2778
2796
  if (idToken) {
2779
2797
  idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);
2780
2798
  if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {
@@ -2786,7 +2804,7 @@ class CacheManager {
2786
2804
  tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims, idToken?.secret);
2787
2805
  return tenantedAccountInfo;
2788
2806
  }
2789
- getTenantProfilesFromAccountEntity(accountEntity, targetTenantId, tenantProfileFilter) {
2807
+ getTenantProfilesFromAccountEntity(accountEntity, correlationId, targetTenantId, tenantProfileFilter) {
2790
2808
  const accountInfo = accountEntity.getAccountInfo();
2791
2809
  let searchTenantProfiles = accountInfo.tenantProfiles || new Map();
2792
2810
  const tokenKeys = this.getTokenKeys();
@@ -2806,7 +2824,7 @@ class CacheManager {
2806
2824
  }
2807
2825
  const matchingTenantProfiles = [];
2808
2826
  searchTenantProfiles.forEach((tenantProfile) => {
2809
- const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter);
2827
+ const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, correlationId, tenantProfileFilter);
2810
2828
  if (tenantedAccountInfo) {
2811
2829
  matchingTenantProfiles.push(tenantedAccountInfo);
2812
2830
  }
@@ -2860,46 +2878,36 @@ class CacheManager {
2860
2878
  * @param storeInCache {?StoreInCache}
2861
2879
  * @param correlationId {?string} correlation id
2862
2880
  */
2863
- async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
2881
+ async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
2864
2882
  if (!cacheRecord) {
2865
2883
  throw createClientAuthError(invalidCacheRecord);
2866
2884
  }
2867
2885
  try {
2868
2886
  if (!!cacheRecord.account) {
2869
- this.setAccount(cacheRecord.account);
2887
+ this.setAccount(cacheRecord.account, correlationId);
2870
2888
  }
2871
2889
  if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
2872
- this.setIdTokenCredential(cacheRecord.idToken);
2890
+ this.setIdTokenCredential(cacheRecord.idToken, correlationId);
2873
2891
  }
2874
2892
  if (!!cacheRecord.accessToken &&
2875
2893
  storeInCache?.accessToken !== false) {
2876
- await this.saveAccessToken(cacheRecord.accessToken);
2894
+ await this.saveAccessToken(cacheRecord.accessToken, correlationId);
2877
2895
  }
2878
2896
  if (!!cacheRecord.refreshToken &&
2879
2897
  storeInCache?.refreshToken !== false) {
2880
- this.setRefreshTokenCredential(cacheRecord.refreshToken);
2898
+ this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
2881
2899
  }
2882
2900
  if (!!cacheRecord.appMetadata) {
2883
- this.setAppMetadata(cacheRecord.appMetadata);
2901
+ this.setAppMetadata(cacheRecord.appMetadata, correlationId);
2884
2902
  }
2885
2903
  }
2886
2904
  catch (e) {
2887
2905
  this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
2888
- if (e instanceof Error) {
2889
- this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);
2890
- if (e.name === "QuotaExceededError" ||
2891
- e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
2892
- e.message.includes("exceeded the quota")) {
2893
- this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
2894
- throw new CacheError(cacheQuotaExceededErrorCode);
2895
- }
2896
- else {
2897
- throw new CacheError(e.name, e.message);
2898
- }
2906
+ if (e instanceof AuthError) {
2907
+ throw e;
2899
2908
  }
2900
2909
  else {
2901
- this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);
2902
- throw new CacheError(cacheUnknownErrorCode);
2910
+ throw createCacheError(e);
2903
2911
  }
2904
2912
  }
2905
2913
  }
@@ -2907,7 +2915,7 @@ class CacheManager {
2907
2915
  * saves access token credential
2908
2916
  * @param credential
2909
2917
  */
2910
- async saveAccessToken(credential) {
2918
+ async saveAccessToken(credential, correlationId) {
2911
2919
  const accessTokenFilter = {
2912
2920
  clientId: credential.clientId,
2913
2921
  credentialType: credential.credentialType,
@@ -2919,29 +2927,27 @@ class CacheManager {
2919
2927
  };
2920
2928
  const tokenKeys = this.getTokenKeys();
2921
2929
  const currentScopes = ScopeSet.fromString(credential.target);
2922
- const removedAccessTokens = [];
2923
2930
  tokenKeys.accessToken.forEach((key) => {
2924
2931
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
2925
2932
  return;
2926
2933
  }
2927
- const tokenEntity = this.getAccessTokenCredential(key);
2934
+ const tokenEntity = this.getAccessTokenCredential(key, correlationId);
2928
2935
  if (tokenEntity &&
2929
2936
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {
2930
2937
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
2931
2938
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
2932
- removedAccessTokens.push(this.removeAccessToken(key));
2939
+ this.removeAccessToken(key, correlationId);
2933
2940
  }
2934
2941
  }
2935
2942
  });
2936
- await Promise.all(removedAccessTokens);
2937
- this.setAccessTokenCredential(credential);
2943
+ this.setAccessTokenCredential(credential, correlationId);
2938
2944
  }
2939
2945
  /**
2940
2946
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
2941
2947
  * Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
2942
2948
  * @param accountFilter - An object containing Account properties to filter by
2943
2949
  */
2944
- getAccountsFilteredBy(accountFilter) {
2950
+ getAccountsFilteredBy(accountFilter, correlationId) {
2945
2951
  const allAccountKeys = this.getAccountKeys();
2946
2952
  const matchingAccounts = [];
2947
2953
  allAccountKeys.forEach((cacheKey) => {
@@ -2949,7 +2955,7 @@ class CacheManager {
2949
2955
  // Don't parse value if the key doesn't match the account filters
2950
2956
  return;
2951
2957
  }
2952
- const entity = this.getAccount(cacheKey, this.commonLogger);
2958
+ const entity = this.getAccount(cacheKey, correlationId, this.commonLogger);
2953
2959
  // Match base account fields
2954
2960
  if (!entity) {
2955
2961
  return;
@@ -3175,11 +3181,11 @@ class CacheManager {
3175
3181
  /**
3176
3182
  * Removes all accounts and related tokens from cache.
3177
3183
  */
3178
- async removeAllAccounts() {
3184
+ async removeAllAccounts(correlationId) {
3179
3185
  const allAccountKeys = this.getAccountKeys();
3180
3186
  const removedAccounts = [];
3181
3187
  allAccountKeys.forEach((cacheKey) => {
3182
- removedAccounts.push(this.removeAccount(cacheKey));
3188
+ removedAccounts.push(this.removeAccount(cacheKey, correlationId));
3183
3189
  });
3184
3190
  await Promise.all(removedAccounts);
3185
3191
  }
@@ -3187,38 +3193,41 @@ class CacheManager {
3187
3193
  * Removes the account and related tokens for a given account key
3188
3194
  * @param account
3189
3195
  */
3190
- async removeAccount(accountKey) {
3191
- const account = this.getAccount(accountKey, this.commonLogger);
3196
+ async removeAccount(accountKey, correlationId) {
3197
+ const account = this.getAccount(accountKey, correlationId, this.commonLogger);
3192
3198
  if (!account) {
3193
3199
  return;
3194
3200
  }
3195
- await this.removeAccountContext(account);
3196
- this.removeItem(accountKey);
3201
+ await this.removeAccountContext(account, correlationId);
3202
+ this.removeItem(accountKey, correlationId);
3197
3203
  }
3198
3204
  /**
3199
3205
  * Removes credentials associated with the provided account
3200
3206
  * @param account
3201
3207
  */
3202
- async removeAccountContext(account) {
3208
+ async removeAccountContext(account, correlationId) {
3203
3209
  const allTokenKeys = this.getTokenKeys();
3204
3210
  const accountId = account.generateAccountId();
3205
- const removedCredentials = [];
3206
3211
  allTokenKeys.idToken.forEach((key) => {
3207
3212
  if (key.indexOf(accountId) === 0) {
3208
- this.removeIdToken(key);
3213
+ this.removeIdToken(key, correlationId);
3209
3214
  }
3210
3215
  });
3211
3216
  allTokenKeys.accessToken.forEach((key) => {
3212
3217
  if (key.indexOf(accountId) === 0) {
3213
- removedCredentials.push(this.removeAccessToken(key));
3218
+ this.removeAccessToken(key, correlationId);
3214
3219
  }
3215
3220
  });
3216
3221
  allTokenKeys.refreshToken.forEach((key) => {
3217
3222
  if (key.indexOf(accountId) === 0) {
3218
- this.removeRefreshToken(key);
3223
+ this.removeRefreshToken(key, correlationId);
3224
+ }
3225
+ });
3226
+ this.getKeys().forEach((key) => {
3227
+ if (key.includes(accountId)) {
3228
+ this.removeItem(key, correlationId);
3219
3229
  }
3220
3230
  });
3221
- await Promise.all(removedCredentials);
3222
3231
  }
3223
3232
  /**
3224
3233
  * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
@@ -3228,7 +3237,7 @@ class CacheManager {
3228
3237
  * @param logger
3229
3238
  * @returns
3230
3239
  */
3231
- updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
3240
+ updateOutdatedCachedAccount(accountKey, accountEntity, correlationId, logger) {
3232
3241
  // Only update if account entity is defined and has no tenantProfiles object (is outdated)
3233
3242
  if (accountEntity && accountEntity.isSingleTenant()) {
3234
3243
  this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
@@ -3239,7 +3248,7 @@ class CacheManager {
3239
3248
  // Get all account entities belonging to user
3240
3249
  const accountsToMerge = [];
3241
3250
  matchingAccountKeys.forEach((key) => {
3242
- const account = this.getCachedAccountEntity(key);
3251
+ const account = this.getCachedAccountEntity(key, correlationId);
3243
3252
  if (account) {
3244
3253
  accountsToMerge.push(account);
3245
3254
  }
@@ -3264,11 +3273,11 @@ class CacheManager {
3264
3273
  // Clear cache of legacy account objects that have been collpsed into tenant profiles
3265
3274
  matchingAccountKeys.forEach((key) => {
3266
3275
  if (key !== newAccountKey) {
3267
- this.removeOutdatedAccount(accountKey);
3276
+ this.removeOutdatedAccount(accountKey, correlationId);
3268
3277
  }
3269
3278
  });
3270
3279
  // Cache updated account object
3271
- this.setAccount(updatedAccount);
3280
+ this.setAccount(updatedAccount, correlationId);
3272
3281
  logger?.verbose("Updated an outdated account entity in the cache");
3273
3282
  return updatedAccount;
3274
3283
  }
@@ -3279,37 +3288,31 @@ class CacheManager {
3279
3288
  * returns a boolean if the given credential is removed
3280
3289
  * @param credential
3281
3290
  */
3282
- async removeAccessToken(key) {
3283
- const credential = this.getAccessTokenCredential(key);
3284
- if (!credential) {
3291
+ removeAccessToken(key, correlationId) {
3292
+ const credential = this.getAccessTokenCredential(key, correlationId);
3293
+ this.removeItem(key, correlationId);
3294
+ if (!credential ||
3295
+ credential.credentialType.toLowerCase() !==
3296
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase() ||
3297
+ credential.tokenType !== AuthenticationScheme.POP) {
3285
3298
  return;
3286
3299
  }
3287
3300
  // Remove Token Binding Key from key store for PoP Tokens Credentials
3288
- if (credential.credentialType.toLowerCase() ===
3289
- CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
3290
- if (credential.tokenType === AuthenticationScheme.POP) {
3291
- const accessTokenWithAuthSchemeEntity = credential;
3292
- const kid = accessTokenWithAuthSchemeEntity.keyId;
3293
- if (kid) {
3294
- try {
3295
- await this.cryptoImpl.removeTokenBindingKey(kid);
3296
- }
3297
- catch (error) {
3298
- throw createClientAuthError(bindingKeyNotRemoved);
3299
- }
3300
- }
3301
- }
3301
+ const kid = credential.keyId;
3302
+ if (kid) {
3303
+ void this.cryptoImpl.removeTokenBindingKey(kid).catch(() => {
3304
+ this.commonLogger.error("Binding key could not be removed");
3305
+ });
3302
3306
  }
3303
- return this.removeItem(key);
3304
3307
  }
3305
3308
  /**
3306
3309
  * Removes all app metadata objects from cache.
3307
3310
  */
3308
- removeAppMetadata() {
3311
+ removeAppMetadata(correlationId) {
3309
3312
  const allCacheKeys = this.getKeys();
3310
3313
  allCacheKeys.forEach((cacheKey) => {
3311
3314
  if (this.isAppMetadata(cacheKey)) {
3312
- this.removeItem(cacheKey);
3315
+ this.removeItem(cacheKey, correlationId);
3313
3316
  }
3314
3317
  });
3315
3318
  return true;
@@ -3318,9 +3321,9 @@ class CacheManager {
3318
3321
  * Retrieve AccountEntity from cache
3319
3322
  * @param account
3320
3323
  */
3321
- readAccountFromCache(account) {
3324
+ readAccountFromCache(account, correlationId) {
3322
3325
  const accountKey = AccountEntity.generateAccountCacheKey(account);
3323
- return this.getAccount(accountKey, this.commonLogger);
3326
+ return this.getAccount(accountKey, correlationId, this.commonLogger);
3324
3327
  }
3325
3328
  /**
3326
3329
  * Retrieve IdTokenEntity from cache
@@ -3330,7 +3333,7 @@ class CacheManager {
3330
3333
  * @param performanceClient {?IPerformanceClient}
3331
3334
  * @param correlationId {?string}
3332
3335
  */
3333
- getIdToken(account, tokenKeys, targetRealm, performanceClient, correlationId) {
3336
+ getIdToken(account, correlationId, tokenKeys, targetRealm, performanceClient) {
3334
3337
  this.commonLogger.trace("CacheManager - getIdToken called");
3335
3338
  const idTokenFilter = {
3336
3339
  homeAccountId: account.homeAccountId,
@@ -3339,7 +3342,7 @@ class CacheManager {
3339
3342
  clientId: this.clientId,
3340
3343
  realm: targetRealm,
3341
3344
  };
3342
- const idTokenMap = this.getIdTokensByFilter(idTokenFilter, tokenKeys);
3345
+ const idTokenMap = this.getIdTokensByFilter(idTokenFilter, correlationId, tokenKeys);
3343
3346
  const numIdTokens = idTokenMap.size;
3344
3347
  if (numIdTokens < 1) {
3345
3348
  this.commonLogger.info("CacheManager:getIdToken - No token found");
@@ -3372,7 +3375,7 @@ class CacheManager {
3372
3375
  // Multiple tokens for a single tenant profile, remove all and return null
3373
3376
  this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them");
3374
3377
  tokensToBeRemoved.forEach((idToken, key) => {
3375
- this.removeIdToken(key);
3378
+ this.removeIdToken(key, correlationId);
3376
3379
  });
3377
3380
  if (performanceClient && correlationId) {
3378
3381
  performanceClient.addFields({ multiMatchedID: idTokenMap.size }, correlationId);
@@ -3387,7 +3390,7 @@ class CacheManager {
3387
3390
  * @param filter
3388
3391
  * @returns
3389
3392
  */
3390
- getIdTokensByFilter(filter, tokenKeys) {
3393
+ getIdTokensByFilter(filter, correlationId, tokenKeys) {
3391
3394
  const idTokenKeys = (tokenKeys && tokenKeys.idToken) || this.getTokenKeys().idToken;
3392
3395
  const idTokens = new Map();
3393
3396
  idTokenKeys.forEach((key) => {
@@ -3397,7 +3400,7 @@ class CacheManager {
3397
3400
  })) {
3398
3401
  return;
3399
3402
  }
3400
- const idToken = this.getIdTokenCredential(key);
3403
+ const idToken = this.getIdTokenCredential(key, correlationId);
3401
3404
  if (idToken && this.credentialMatchesFilter(idToken, filter)) {
3402
3405
  idTokens.set(key, idToken);
3403
3406
  }
@@ -3426,15 +3429,15 @@ class CacheManager {
3426
3429
  * Removes idToken from the cache
3427
3430
  * @param key
3428
3431
  */
3429
- removeIdToken(key) {
3430
- this.removeItem(key);
3432
+ removeIdToken(key, correlationId) {
3433
+ this.removeItem(key, correlationId);
3431
3434
  }
3432
3435
  /**
3433
3436
  * Removes refresh token from the cache
3434
3437
  * @param key
3435
3438
  */
3436
- removeRefreshToken(key) {
3437
- this.removeItem(key);
3439
+ removeRefreshToken(key, correlationId) {
3440
+ this.removeItem(key, correlationId);
3438
3441
  }
3439
3442
  /**
3440
3443
  * Retrieve AccessTokenEntity from cache
@@ -3444,7 +3447,7 @@ class CacheManager {
3444
3447
  * @param performanceClient {?IPerformanceClient}
3445
3448
  * @param correlationId {?string}
3446
3449
  */
3447
- getAccessToken(account, request, tokenKeys, targetRealm, performanceClient, correlationId) {
3450
+ getAccessToken(account, request, tokenKeys, targetRealm, performanceClient) {
3448
3451
  this.commonLogger.trace("CacheManager - getAccessToken called");
3449
3452
  const scopes = ScopeSet.createSearchScopes(request.scopes);
3450
3453
  const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
@@ -3474,7 +3477,7 @@ class CacheManager {
3474
3477
  accessTokenKeys.forEach((key) => {
3475
3478
  // Validate key
3476
3479
  if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
3477
- const accessToken = this.getAccessTokenCredential(key);
3480
+ const accessToken = this.getAccessTokenCredential(key, request.correlationId);
3478
3481
  // Validate value
3479
3482
  if (accessToken &&
3480
3483
  this.credentialMatchesFilter(accessToken, accessTokenFilter)) {
@@ -3490,10 +3493,10 @@ class CacheManager {
3490
3493
  else if (numAccessTokens > 1) {
3491
3494
  this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them");
3492
3495
  accessTokens.forEach((accessToken) => {
3493
- void this.removeAccessToken(generateCredentialKey(accessToken));
3496
+ void this.removeAccessToken(generateCredentialKey(accessToken), request.correlationId);
3494
3497
  });
3495
- if (performanceClient && correlationId) {
3496
- performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
3498
+ if (performanceClient && request.correlationId) {
3499
+ performanceClient.addFields({ multiMatchedAT: accessTokens.length }, request.correlationId);
3497
3500
  }
3498
3501
  return null;
3499
3502
  }
@@ -3546,14 +3549,14 @@ class CacheManager {
3546
3549
  * @param filter
3547
3550
  * @returns
3548
3551
  */
3549
- getAccessTokensByFilter(filter) {
3552
+ getAccessTokensByFilter(filter, correlationId) {
3550
3553
  const tokenKeys = this.getTokenKeys();
3551
3554
  const accessTokens = [];
3552
3555
  tokenKeys.accessToken.forEach((key) => {
3553
3556
  if (!this.accessTokenKeyMatchesFilter(key, filter, true)) {
3554
3557
  return;
3555
3558
  }
3556
- const accessToken = this.getAccessTokenCredential(key);
3559
+ const accessToken = this.getAccessTokenCredential(key, correlationId);
3557
3560
  if (accessToken &&
3558
3561
  this.credentialMatchesFilter(accessToken, filter)) {
3559
3562
  accessTokens.push(accessToken);
@@ -3569,7 +3572,7 @@ class CacheManager {
3569
3572
  * @param performanceClient {?IPerformanceClient}
3570
3573
  * @param correlationId {?string}
3571
3574
  */
3572
- getRefreshToken(account, familyRT, tokenKeys, performanceClient, correlationId) {
3575
+ getRefreshToken(account, familyRT, correlationId, tokenKeys, performanceClient) {
3573
3576
  this.commonLogger.trace("CacheManager - getRefreshToken called");
3574
3577
  const id = familyRT ? THE_FAMILY_ID : undefined;
3575
3578
  const refreshTokenFilter = {
@@ -3585,7 +3588,7 @@ class CacheManager {
3585
3588
  refreshTokenKeys.forEach((key) => {
3586
3589
  // Validate key
3587
3590
  if (this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {
3588
- const refreshToken = this.getRefreshTokenCredential(key);
3591
+ const refreshToken = this.getRefreshTokenCredential(key, correlationId);
3589
3592
  // Validate value
3590
3593
  if (refreshToken &&
3591
3594
  this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {
@@ -3944,7 +3947,7 @@ class DefaultStorageClass extends CacheManager {
3944
3947
  }
3945
3948
  }
3946
3949
 
3947
- /*! @azure/msal-common v14.16.0 2025-01-14 */
3950
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
3948
3951
 
3949
3952
  /*
3950
3953
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4043,7 +4046,7 @@ function isOidcProtocolMode(config) {
4043
4046
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4044
4047
  }
4045
4048
 
4046
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4049
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4047
4050
  /*
4048
4051
  * Copyright (c) Microsoft Corporation. All rights reserved.
4049
4052
  * Licensed under the MIT License.
@@ -4053,7 +4056,7 @@ const CcsCredentialType = {
4053
4056
  UPN: "UPN",
4054
4057
  };
4055
4058
 
4056
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4059
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4057
4060
  /*
4058
4061
  * Copyright (c) Microsoft Corporation. All rights reserved.
4059
4062
  * Licensed under the MIT License.
@@ -4103,7 +4106,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4103
4106
  const BROKER_CLIENT_ID = "brk_client_id";
4104
4107
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4105
4108
 
4106
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4109
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4107
4110
 
4108
4111
  /*
4109
4112
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4170,7 +4173,7 @@ class RequestValidator {
4170
4173
  }
4171
4174
  }
4172
4175
 
4173
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4176
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4174
4177
 
4175
4178
  /*
4176
4179
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4578,7 +4581,7 @@ class RequestParameterBuilder {
4578
4581
  }
4579
4582
  }
4580
4583
 
4581
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4584
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4582
4585
  /*
4583
4586
  * Copyright (c) Microsoft Corporation. All rights reserved.
4584
4587
  * Licensed under the MIT License.
@@ -4590,7 +4593,7 @@ function isOpenIdConfigResponse(response) {
4590
4593
  response.hasOwnProperty("jwks_uri"));
4591
4594
  }
4592
4595
 
4593
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4596
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4594
4597
  /*
4595
4598
  * Copyright (c) Microsoft Corporation. All rights reserved.
4596
4599
  * Licensed under the MIT License.
@@ -4600,7 +4603,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4600
4603
  response.hasOwnProperty("metadata"));
4601
4604
  }
4602
4605
 
4603
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4606
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4604
4607
  /*
4605
4608
  * Copyright (c) Microsoft Corporation. All rights reserved.
4606
4609
  * Licensed under the MIT License.
@@ -4610,7 +4613,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4610
4613
  response.hasOwnProperty("error_description"));
4611
4614
  }
4612
4615
 
4613
- /*! @azure/msal-common v14.16.0 2025-01-14 */
4616
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
4614
4617
  /*
4615
4618
  * Copyright (c) Microsoft Corporation. All rights reserved.
4616
4619
  * Licensed under the MIT License.
@@ -5097,7 +5100,7 @@ const IntFields = new Set([
5097
5100
  "multiMatchedRT",
5098
5101
  ]);
5099
5102
 
5100
- /*! @azure/msal-common v14.16.0 2025-01-14 */
5103
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5101
5104
  /*
5102
5105
  * Copyright (c) Microsoft Corporation. All rights reserved.
5103
5106
  * Licensed under the MIT License.
@@ -5193,7 +5196,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5193
5196
  };
5194
5197
  };
5195
5198
 
5196
- /*! @azure/msal-common v14.16.0 2025-01-14 */
5199
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5197
5200
 
5198
5201
  /*
5199
5202
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5302,7 +5305,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5302
5305
  },
5303
5306
  };
5304
5307
 
5305
- /*! @azure/msal-common v14.16.0 2025-01-14 */
5308
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
5306
5309
 
5307
5310
  /*
5308
5311
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6141,7 +6144,7 @@ function buildStaticAuthorityOptions(authOptions) {
6141
6144
  };
6142
6145
  }
6143
6146
 
6144
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6147
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6145
6148
 
6146
6149
  /*
6147
6150
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6172,7 +6175,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6172
6175
  }
6173
6176
  }
6174
6177
 
6175
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6178
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6176
6179
 
6177
6180
  /*
6178
6181
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6191,7 +6194,7 @@ class ServerError extends AuthError {
6191
6194
  }
6192
6195
  }
6193
6196
 
6194
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6197
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6195
6198
 
6196
6199
  /*
6197
6200
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6211,12 +6214,12 @@ class ThrottlingUtils {
6211
6214
  * @param cacheManager
6212
6215
  * @param thumbprint
6213
6216
  */
6214
- static preProcess(cacheManager, thumbprint) {
6217
+ static preProcess(cacheManager, thumbprint, correlationId) {
6215
6218
  const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
6216
6219
  const value = cacheManager.getThrottlingCache(key);
6217
6220
  if (value) {
6218
6221
  if (value.throttleTime < Date.now()) {
6219
- cacheManager.removeItem(key);
6222
+ cacheManager.removeItem(key, correlationId);
6220
6223
  return;
6221
6224
  }
6222
6225
  throw new ServerError(value.errorCodes?.join(" ") || Constants.EMPTY_STRING, value.errorMessage, value.subError);
@@ -6228,7 +6231,7 @@ class ThrottlingUtils {
6228
6231
  * @param thumbprint
6229
6232
  * @param response
6230
6233
  */
6231
- static postProcess(cacheManager, thumbprint, response) {
6234
+ static postProcess(cacheManager, thumbprint, response, correlationId) {
6232
6235
  if (ThrottlingUtils.checkResponseStatus(response) ||
6233
6236
  ThrottlingUtils.checkResponseForRetryAfter(response)) {
6234
6237
  const thumbprintValue = {
@@ -6238,7 +6241,7 @@ class ThrottlingUtils {
6238
6241
  errorMessage: response.body.error_description,
6239
6242
  subError: response.body.suberror,
6240
6243
  };
6241
- cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);
6244
+ cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue, correlationId);
6242
6245
  }
6243
6246
  }
6244
6247
  /**
@@ -6285,11 +6288,11 @@ class ThrottlingUtils {
6285
6288
  sshKid: request.sshKid,
6286
6289
  };
6287
6290
  const key = this.generateThrottlingStorageKey(thumbprint);
6288
- cacheManager.removeItem(key);
6291
+ cacheManager.removeItem(key, request.correlationId);
6289
6292
  }
6290
6293
  }
6291
6294
 
6292
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6295
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6293
6296
 
6294
6297
  /*
6295
6298
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6319,7 +6322,7 @@ function createNetworkError(error, httpStatus, responseHeaders) {
6319
6322
  return new NetworkError(error, httpStatus, responseHeaders);
6320
6323
  }
6321
6324
 
6322
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6325
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6323
6326
 
6324
6327
  /*
6325
6328
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6401,7 +6404,7 @@ class BaseClient {
6401
6404
  * @param correlationId - CorrelationId for telemetry
6402
6405
  */
6403
6406
  async sendPostRequest(thumbprint, tokenEndpoint, options, correlationId) {
6404
- ThrottlingUtils.preProcess(this.cacheManager, thumbprint);
6407
+ ThrottlingUtils.preProcess(this.cacheManager, thumbprint, correlationId);
6405
6408
  let response;
6406
6409
  try {
6407
6410
  response = await invokeAsync((this.networkClient.sendPostRequestAsync.bind(this.networkClient)), PerformanceEvents.NetworkClientSendPostRequestAsync, this.logger, this.performanceClient, correlationId)(tokenEndpoint, options);
@@ -6436,7 +6439,7 @@ class BaseClient {
6436
6439
  throw createClientAuthError(networkError);
6437
6440
  }
6438
6441
  }
6439
- ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);
6442
+ ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response, correlationId);
6440
6443
  return response;
6441
6444
  }
6442
6445
  /**
@@ -6469,7 +6472,7 @@ class BaseClient {
6469
6472
  }
6470
6473
  }
6471
6474
 
6472
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6475
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6473
6476
  /*
6474
6477
  * Copyright (c) Microsoft Corporation. All rights reserved.
6475
6478
  * Licensed under the MIT License.
@@ -6495,7 +6498,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6495
6498
  refreshTokenExpired: refreshTokenExpired
6496
6499
  });
6497
6500
 
6498
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6501
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6499
6502
 
6500
6503
  /*
6501
6504
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6583,7 +6586,7 @@ function createInteractionRequiredAuthError(errorCode) {
6583
6586
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6584
6587
  }
6585
6588
 
6586
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6589
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6587
6590
 
6588
6591
  /*
6589
6592
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6655,7 +6658,7 @@ class ProtocolUtils {
6655
6658
  }
6656
6659
  }
6657
6660
 
6658
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6661
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6659
6662
 
6660
6663
  /*
6661
6664
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6739,7 +6742,7 @@ class PopTokenGenerator {
6739
6742
  }
6740
6743
  }
6741
6744
 
6742
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6745
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6743
6746
  /*
6744
6747
  * Copyright (c) Microsoft Corporation. All rights reserved.
6745
6748
  * Licensed under the MIT License.
@@ -6766,7 +6769,7 @@ class PopTokenGenerator {
6766
6769
  }
6767
6770
  }
6768
6771
 
6769
- /*! @azure/msal-common v14.16.0 2025-01-14 */
6772
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
6770
6773
 
6771
6774
  /*
6772
6775
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6926,13 +6929,13 @@ class ResponseHandler {
6926
6929
  !forceCacheRefreshTokenResponse &&
6927
6930
  cacheRecord.account) {
6928
6931
  const key = cacheRecord.account.generateAccountKey();
6929
- const account = this.cacheStorage.getAccount(key, this.logger);
6932
+ const account = this.cacheStorage.getAccount(key, request.correlationId, this.logger);
6930
6933
  if (!account) {
6931
6934
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
6932
6935
  return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
6933
6936
  }
6934
6937
  }
6935
- await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
6938
+ await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, request.storeInCache);
6936
6939
  }
6937
6940
  finally {
6938
6941
  if (this.persistencePlugin &&
@@ -6961,7 +6964,7 @@ class ResponseHandler {
6961
6964
  let cachedAccount;
6962
6965
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6963
6966
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6964
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6967
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, request.correlationId, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6965
6968
  this.logger);
6966
6969
  }
6967
6970
  // AccessToken
@@ -7109,7 +7112,7 @@ class ResponseHandler {
7109
7112
  };
7110
7113
  }
7111
7114
  }
7112
- function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7115
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7113
7116
  logger?.verbose("setCachedAccount called");
7114
7117
  // Check if base account is already cached
7115
7118
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7118,7 +7121,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7118
7121
  });
7119
7122
  let cachedAccount = null;
7120
7123
  if (baseAccountKey) {
7121
- cachedAccount = cacheStorage.getAccount(baseAccountKey, logger);
7124
+ cachedAccount = cacheStorage.getAccount(baseAccountKey, correlationId, logger);
7122
7125
  }
7123
7126
  const baseAccount = cachedAccount ||
7124
7127
  AccountEntity.createAccount({
@@ -7143,7 +7146,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7143
7146
  return baseAccount;
7144
7147
  }
7145
7148
 
7146
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7149
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7147
7150
  /*
7148
7151
  * Copyright (c) Microsoft Corporation. All rights reserved.
7149
7152
  * Licensed under the MIT License.
@@ -7161,7 +7164,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
7161
7164
  }
7162
7165
  }
7163
7166
 
7164
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7167
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7165
7168
 
7166
7169
  /*
7167
7170
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7603,7 +7606,7 @@ class AuthorizationCodeClient extends BaseClient {
7603
7606
  }
7604
7607
  }
7605
7608
 
7606
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7609
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7607
7610
 
7608
7611
  /*
7609
7612
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7676,7 +7679,7 @@ class RefreshTokenClient extends BaseClient {
7676
7679
  async acquireTokenWithCachedRefreshToken(request, foci) {
7677
7680
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
7678
7681
  // fetches family RT or application RT based on FOCI value
7679
- const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, undefined, this.performanceClient, request.correlationId);
7682
+ const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, request.correlationId, undefined, this.performanceClient);
7680
7683
  if (!refreshToken) {
7681
7684
  throw createInteractionRequiredAuthError(noTokensFound);
7682
7685
  }
@@ -7704,7 +7707,7 @@ class RefreshTokenClient extends BaseClient {
7704
7707
  // Remove bad refresh token from cache
7705
7708
  this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");
7706
7709
  const badRefreshTokenKey = generateCredentialKey(refreshToken);
7707
- this.cacheManager.removeRefreshToken(badRefreshTokenKey);
7710
+ this.cacheManager.removeRefreshToken(badRefreshTokenKey, request.correlationId);
7708
7711
  }
7709
7712
  throw e;
7710
7713
  }
@@ -7823,7 +7826,7 @@ class RefreshTokenClient extends BaseClient {
7823
7826
  }
7824
7827
  }
7825
7828
 
7826
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7829
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7827
7830
 
7828
7831
  /*
7829
7832
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7893,7 +7896,7 @@ class SilentFlowClient extends BaseClient {
7893
7896
  const requestTenantId = request.account.tenantId ||
7894
7897
  getTenantFromAuthorityString(request.authority);
7895
7898
  const tokenKeys = this.cacheManager.getTokenKeys();
7896
- const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId, this.performanceClient, request.correlationId);
7899
+ const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId, this.performanceClient);
7897
7900
  if (!cachedAccessToken) {
7898
7901
  // must refresh due to non-existent access_token
7899
7902
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
@@ -7913,9 +7916,9 @@ class SilentFlowClient extends BaseClient {
7913
7916
  }
7914
7917
  const environment = request.authority || this.authority.getPreferredCache();
7915
7918
  const cacheRecord = {
7916
- account: this.cacheManager.readAccountFromCache(request.account),
7919
+ account: this.cacheManager.readAccountFromCache(request.account, request.correlationId),
7917
7920
  accessToken: cachedAccessToken,
7918
- idToken: this.cacheManager.getIdToken(request.account, tokenKeys, requestTenantId, this.performanceClient, request.correlationId),
7921
+ idToken: this.cacheManager.getIdToken(request.account, request.correlationId, tokenKeys, requestTenantId, this.performanceClient),
7919
7922
  refreshToken: null,
7920
7923
  appMetadata: this.cacheManager.readAppMetadataFromCache(environment),
7921
7924
  };
@@ -7959,7 +7962,7 @@ class SilentFlowClient extends BaseClient {
7959
7962
  }
7960
7963
  }
7961
7964
 
7962
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7965
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7963
7966
 
7964
7967
  /*
7965
7968
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7974,7 +7977,7 @@ const StubbedNetworkModule = {
7974
7977
  },
7975
7978
  };
7976
7979
 
7977
- /*! @azure/msal-common v14.16.0 2025-01-14 */
7980
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
7978
7981
 
7979
7982
  /*
7980
7983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8032,7 +8035,7 @@ class AuthenticationHeaderParser {
8032
8035
  }
8033
8036
  }
8034
8037
 
8035
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8038
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8036
8039
 
8037
8040
  /*
8038
8041
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8171,7 +8174,7 @@ class ServerTelemetryManager {
8171
8174
  else {
8172
8175
  lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);
8173
8176
  }
8174
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8177
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8175
8178
  return;
8176
8179
  }
8177
8180
  /**
@@ -8180,7 +8183,7 @@ class ServerTelemetryManager {
8180
8183
  incrementCacheHits() {
8181
8184
  const lastRequests = this.getLastRequests();
8182
8185
  lastRequests.cacheHits += 1;
8183
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8186
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8184
8187
  return lastRequests.cacheHits;
8185
8188
  }
8186
8189
  /**
@@ -8204,7 +8207,7 @@ class ServerTelemetryManager {
8204
8207
  const errorCount = lastRequests.errors.length;
8205
8208
  if (numErrorsFlushed === errorCount) {
8206
8209
  // All errors were sent on last request, clear Telemetry cache
8207
- this.cacheManager.removeItem(this.telemetryCacheKey);
8210
+ this.cacheManager.removeItem(this.telemetryCacheKey, this.correlationId);
8208
8211
  }
8209
8212
  else {
8210
8213
  // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
@@ -8213,7 +8216,7 @@ class ServerTelemetryManager {
8213
8216
  errors: lastRequests.errors.slice(numErrorsFlushed),
8214
8217
  cacheHits: 0,
8215
8218
  };
8216
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
8219
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity, this.correlationId);
8217
8220
  }
8218
8221
  }
8219
8222
  /**
@@ -8280,7 +8283,7 @@ class ServerTelemetryManager {
8280
8283
  setNativeBrokerErrorCode(errorCode) {
8281
8284
  const lastRequests = this.getLastRequests();
8282
8285
  lastRequests.nativeBrokerErrorCode = errorCode;
8283
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8286
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8284
8287
  }
8285
8288
  getNativeBrokerErrorCode() {
8286
8289
  return this.getLastRequests().nativeBrokerErrorCode;
@@ -8288,14 +8291,14 @@ class ServerTelemetryManager {
8288
8291
  clearNativeBrokerErrorCode() {
8289
8292
  const lastRequests = this.getLastRequests();
8290
8293
  delete lastRequests.nativeBrokerErrorCode;
8291
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
8294
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
8292
8295
  }
8293
8296
  static makeExtraSkuString(params) {
8294
8297
  return makeExtraSkuString(params);
8295
8298
  }
8296
8299
  }
8297
8300
 
8298
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8301
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8299
8302
  /*
8300
8303
  * Copyright (c) Microsoft Corporation. All rights reserved.
8301
8304
  * Licensed under the MIT License.
@@ -8303,7 +8306,7 @@ class ServerTelemetryManager {
8303
8306
  const missingKidError = "missing_kid_error";
8304
8307
  const missingAlgError = "missing_alg_error";
8305
8308
 
8306
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8309
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8307
8310
 
8308
8311
  /*
8309
8312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8328,7 +8331,7 @@ function createJoseHeaderError(code) {
8328
8331
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
8329
8332
  }
8330
8333
 
8331
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8334
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8332
8335
 
8333
8336
  /*
8334
8337
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8368,7 +8371,7 @@ class JoseHeader {
8368
8371
  }
8369
8372
  }
8370
8373
 
8371
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8374
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8372
8375
 
8373
8376
  /*
8374
8377
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8447,7 +8450,7 @@ class StubPerformanceClient {
8447
8450
  }
8448
8451
  }
8449
8452
 
8450
- /*! @azure/msal-common v14.16.0 2025-01-14 */
8453
+ /*! @azure/msal-common v14.16.1 2025-08-05 */
8451
8454
 
8452
8455
  /*
8453
8456
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9510,6 +9513,7 @@ const TemporaryCacheKeys = {
9510
9513
  const StaticCacheKeys = {
9511
9514
  ACCOUNT_KEYS: "msal.account.keys",
9512
9515
  TOKEN_KEYS: "msal.token.keys",
9516
+ VERSION: "msal.version",
9513
9517
  };
9514
9518
  /**
9515
9519
  * Cache keys stored in-memory
@@ -10368,7 +10372,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
10368
10372
 
10369
10373
  /* eslint-disable header/header */
10370
10374
  const name = "@azure/msal-browser";
10371
- const version = "3.28.1";
10375
+ const version = "3.30.0";
10372
10376
 
10373
10377
  /*
10374
10378
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11509,6 +11513,13 @@ class BrowserCacheManager extends CacheManager {
11509
11513
  * @param storeAuthStateInCookie
11510
11514
  */
11511
11515
  migrateCacheEntries() {
11516
+ const previousVersion = this.browserStorage.getItem(StaticCacheKeys.VERSION);
11517
+ if (previousVersion) {
11518
+ this.logger.info(`MSAL.js was last initialized with version ${previousVersion}`);
11519
+ }
11520
+ if (previousVersion !== version) {
11521
+ this.browserStorage.setItem(StaticCacheKeys.VERSION, version);
11522
+ }
11512
11523
  const idTokenKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ID_TOKEN}`;
11513
11524
  const clientInfoKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.CLIENT_INFO}`;
11514
11525
  const errorKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ERROR}`;
@@ -11543,6 +11554,7 @@ class BrowserCacheManager extends CacheManager {
11543
11554
  */
11544
11555
  createKeyMaps() {
11545
11556
  this.logger.trace("BrowserCacheManager - createKeyMaps called.");
11557
+ const correlationId = this.cryptoImpl.createNewGuid();
11546
11558
  const accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
11547
11559
  const tokenKeys = this.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
11548
11560
  if (accountKeys && tokenKeys) {
@@ -11564,8 +11576,8 @@ class BrowserCacheManager extends CacheManager {
11564
11576
  this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map");
11565
11577
  this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${key} found, saving key to token key map`);
11566
11578
  const idTokenEntity = credObj;
11567
- const newKey = this.updateCredentialCacheKey(key, idTokenEntity);
11568
- this.addTokenKey(newKey, CredentialType.ID_TOKEN);
11579
+ const newKey = this.updateCredentialCacheKey(key, idTokenEntity, correlationId);
11580
+ this.addTokenKey(newKey, CredentialType.ID_TOKEN, correlationId);
11569
11581
  return;
11570
11582
  }
11571
11583
  else {
@@ -11579,8 +11591,8 @@ class BrowserCacheManager extends CacheManager {
11579
11591
  this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map");
11580
11592
  this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${key} found, saving key to token key map`);
11581
11593
  const accessTokenEntity = credObj;
11582
- const newKey = this.updateCredentialCacheKey(key, accessTokenEntity);
11583
- this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN);
11594
+ const newKey = this.updateCredentialCacheKey(key, accessTokenEntity, correlationId);
11595
+ this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN, correlationId);
11584
11596
  return;
11585
11597
  }
11586
11598
  else {
@@ -11593,8 +11605,8 @@ class BrowserCacheManager extends CacheManager {
11593
11605
  this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map");
11594
11606
  this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${key} found, saving key to token key map`);
11595
11607
  const refreshTokenEntity = credObj;
11596
- const newKey = this.updateCredentialCacheKey(key, refreshTokenEntity);
11597
- this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN);
11608
+ const newKey = this.updateCredentialCacheKey(key, refreshTokenEntity, correlationId);
11609
+ this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN, correlationId);
11598
11610
  return;
11599
11611
  }
11600
11612
  else {
@@ -11615,7 +11627,7 @@ class BrowserCacheManager extends CacheManager {
11615
11627
  AccountEntity.isAccountEntity(accountObj)) {
11616
11628
  this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map");
11617
11629
  this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${key} found, saving key to account key map`);
11618
- this.addAccountKeyToMap(key);
11630
+ this.addAccountKeyToMap(key, correlationId);
11619
11631
  }
11620
11632
  }
11621
11633
  }
@@ -11654,17 +11666,58 @@ class BrowserCacheManager extends CacheManager {
11654
11666
  * @param key
11655
11667
  * @param value
11656
11668
  */
11657
- setItem(key, value) {
11658
- this.browserStorage.setItem(key, value);
11669
+ setItem(key, value, correlationId) {
11670
+ let accessTokenKeys = [];
11671
+ const maxRetries = 20;
11672
+ for (let i = 0; i <= maxRetries; i++) {
11673
+ try {
11674
+ this.browserStorage.setItem(key, value);
11675
+ if (i > 0) {
11676
+ // Finally update the token keys array with the tokens removed
11677
+ this.removeAccessTokenKeys(accessTokenKeys.slice(0, i), correlationId);
11678
+ }
11679
+ break; // If setItem succeeds, exit the loop
11680
+ }
11681
+ catch (e) {
11682
+ const cacheError = createCacheError(e);
11683
+ if (cacheError.errorCode ===
11684
+ cacheQuotaExceeded &&
11685
+ i < maxRetries) {
11686
+ if (!accessTokenKeys.length) {
11687
+ if (key ===
11688
+ `${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`) {
11689
+ // If we are currently trying to set the token keys, use the value we're trying to set
11690
+ accessTokenKeys = JSON.parse(value)
11691
+ .accessToken;
11692
+ }
11693
+ else {
11694
+ // If token keys have not been initialized, get them
11695
+ accessTokenKeys = this.getTokenKeys().accessToken;
11696
+ }
11697
+ }
11698
+ if (accessTokenKeys.length <= i) {
11699
+ // Nothing to remove, rethrow the error
11700
+ throw cacheError;
11701
+ }
11702
+ // When cache quota is exceeded, start removing access tokens until we can successfully set the item
11703
+ this.removeAccessToken(accessTokenKeys[i], correlationId, false // Don't save token keys yet, do it at the end
11704
+ );
11705
+ }
11706
+ else {
11707
+ // If the error is not a quota exceeded error, rethrow it
11708
+ throw cacheError;
11709
+ }
11710
+ }
11711
+ }
11659
11712
  }
11660
11713
  /**
11661
11714
  * fetch the account entity from the platform cache
11662
11715
  * @param accountKey
11663
11716
  */
11664
- getAccount(accountKey, logger) {
11717
+ getAccount(accountKey, correlationId, logger) {
11665
11718
  this.logger.trace("BrowserCacheManager.getAccount called");
11666
- const accountEntity = this.getCachedAccountEntity(accountKey);
11667
- return this.updateOutdatedCachedAccount(accountKey, accountEntity, logger);
11719
+ const accountEntity = this.getCachedAccountEntity(accountKey, correlationId);
11720
+ return this.updateOutdatedCachedAccount(accountKey, accountEntity, correlationId, logger);
11668
11721
  }
11669
11722
  /**
11670
11723
  * Reads account from cache, deserializes it into an account entity and returns it.
@@ -11672,15 +11725,14 @@ class BrowserCacheManager extends CacheManager {
11672
11725
  * @param accountKey
11673
11726
  * @returns
11674
11727
  */
11675
- getCachedAccountEntity(accountKey) {
11728
+ getCachedAccountEntity(accountKey, correlationId) {
11676
11729
  const serializedAccount = this.getItem(accountKey);
11677
11730
  if (!serializedAccount) {
11678
- this.removeAccountKeyFromMap(accountKey);
11731
+ this.removeAccountKeyFromMap(accountKey, correlationId);
11679
11732
  return null;
11680
11733
  }
11681
11734
  const parsedAccount = this.validateAndParseJson(serializedAccount);
11682
11735
  if (!parsedAccount || !AccountEntity.isAccountEntity(parsedAccount)) {
11683
- this.removeAccountKeyFromMap(accountKey);
11684
11736
  return null;
11685
11737
  }
11686
11738
  return CacheManager.toObject(new AccountEntity(), parsedAccount);
@@ -11689,11 +11741,12 @@ class BrowserCacheManager extends CacheManager {
11689
11741
  * set account entity in the platform cache
11690
11742
  * @param account
11691
11743
  */
11692
- setAccount(account) {
11744
+ setAccount(account, correlationId) {
11693
11745
  this.logger.trace("BrowserCacheManager.setAccount called");
11694
11746
  const key = account.generateAccountKey();
11695
- this.setItem(key, JSON.stringify(account));
11696
- this.addAccountKeyToMap(key);
11747
+ account.lastUpdatedAt = Date.now().toString();
11748
+ this.setItem(key, JSON.stringify(account), correlationId);
11749
+ this.addAccountKeyToMap(key, correlationId);
11697
11750
  }
11698
11751
  /**
11699
11752
  * Returns the array of account keys currently cached
@@ -11712,14 +11765,14 @@ class BrowserCacheManager extends CacheManager {
11712
11765
  * Add a new account to the key map
11713
11766
  * @param key
11714
11767
  */
11715
- addAccountKeyToMap(key) {
11768
+ addAccountKeyToMap(key, correlationId) {
11716
11769
  this.logger.trace("BrowserCacheManager.addAccountKeyToMap called");
11717
11770
  this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${key}`);
11718
11771
  const accountKeys = this.getAccountKeys();
11719
11772
  if (accountKeys.indexOf(key) === -1) {
11720
11773
  // Only add key if it does not already exist in the map
11721
11774
  accountKeys.push(key);
11722
- this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
11775
+ this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys), correlationId);
11723
11776
  this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
11724
11777
  }
11725
11778
  else {
@@ -11730,14 +11783,21 @@ class BrowserCacheManager extends CacheManager {
11730
11783
  * Remove an account from the key map
11731
11784
  * @param key
11732
11785
  */
11733
- removeAccountKeyFromMap(key) {
11786
+ removeAccountKeyFromMap(key, correlationId) {
11734
11787
  this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called");
11735
11788
  this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${key}`);
11736
11789
  const accountKeys = this.getAccountKeys();
11737
11790
  const removalIndex = accountKeys.indexOf(key);
11738
11791
  if (removalIndex > -1) {
11739
11792
  accountKeys.splice(removalIndex, 1);
11740
- this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
11793
+ if (accountKeys.length === 0) {
11794
+ // If no keys left, remove the map
11795
+ this.removeItem(StaticCacheKeys.ACCOUNT_KEYS);
11796
+ return;
11797
+ }
11798
+ else {
11799
+ this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys), correlationId);
11800
+ }
11741
11801
  this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed");
11742
11802
  }
11743
11803
  else {
@@ -11748,41 +11808,60 @@ class BrowserCacheManager extends CacheManager {
11748
11808
  * Extends inherited removeAccount function to include removal of the account key from the map
11749
11809
  * @param key
11750
11810
  */
11751
- async removeAccount(key) {
11752
- void super.removeAccount(key);
11753
- this.removeAccountKeyFromMap(key);
11811
+ async removeAccount(key, correlationId) {
11812
+ void super.removeAccount(key, correlationId);
11813
+ this.removeAccountKeyFromMap(key, correlationId);
11754
11814
  }
11755
11815
  /**
11756
11816
  * Remove account entity from the platform cache if it's outdated
11757
11817
  * @param accountKey
11758
11818
  */
11759
- removeOutdatedAccount(accountKey) {
11819
+ removeOutdatedAccount(accountKey, correlationId) {
11760
11820
  this.removeItem(accountKey);
11761
- this.removeAccountKeyFromMap(accountKey);
11821
+ this.removeAccountKeyFromMap(accountKey, correlationId);
11762
11822
  }
11763
11823
  /**
11764
11824
  * Removes given idToken from the cache and from the key map
11765
11825
  * @param key
11766
11826
  */
11767
- removeIdToken(key) {
11768
- super.removeIdToken(key);
11769
- this.removeTokenKey(key, CredentialType.ID_TOKEN);
11827
+ removeIdToken(key, correlationId) {
11828
+ super.removeIdToken(key, correlationId);
11829
+ this.removeTokenKey(key, CredentialType.ID_TOKEN, correlationId);
11770
11830
  }
11771
11831
  /**
11772
11832
  * Removes given accessToken from the cache and from the key map
11773
11833
  * @param key
11774
11834
  */
11775
- async removeAccessToken(key) {
11776
- void super.removeAccessToken(key);
11777
- this.removeTokenKey(key, CredentialType.ACCESS_TOKEN);
11835
+ removeAccessToken(key, correlationId, updateTokenKeys = true) {
11836
+ super.removeAccessToken(key, correlationId);
11837
+ this.performanceClient?.incrementFields({ accessTokensRemoved: 1 }, correlationId);
11838
+ updateTokenKeys &&
11839
+ this.removeTokenKey(key, CredentialType.ACCESS_TOKEN, correlationId);
11840
+ }
11841
+ removeAccessTokenKeys(keys, correlationId) {
11842
+ this.logger.trace("removeAccessTokenKey called");
11843
+ const tokenKeys = this.getTokenKeys();
11844
+ let keysRemoved = 0;
11845
+ keys.forEach((key) => {
11846
+ const accessRemoval = tokenKeys.accessToken.indexOf(key);
11847
+ if (accessRemoval > -1) {
11848
+ tokenKeys.accessToken.splice(accessRemoval, 1);
11849
+ keysRemoved++;
11850
+ }
11851
+ });
11852
+ if (keysRemoved > 0) {
11853
+ this.logger.info(`removed ${keysRemoved} accessToken keys from tokenKeys map`);
11854
+ this.setTokenKeys(tokenKeys, correlationId);
11855
+ return;
11856
+ }
11778
11857
  }
11779
11858
  /**
11780
11859
  * Removes given refreshToken from the cache and from the key map
11781
11860
  * @param key
11782
11861
  */
11783
- removeRefreshToken(key) {
11784
- super.removeRefreshToken(key);
11785
- this.removeTokenKey(key, CredentialType.REFRESH_TOKEN);
11862
+ removeRefreshToken(key, correlationId) {
11863
+ super.removeRefreshToken(key, correlationId);
11864
+ this.removeTokenKey(key, CredentialType.REFRESH_TOKEN, correlationId);
11786
11865
  }
11787
11866
  /**
11788
11867
  * Gets the keys for the cached tokens associated with this clientId
@@ -11812,12 +11891,30 @@ class BrowserCacheManager extends CacheManager {
11812
11891
  refreshToken: [],
11813
11892
  };
11814
11893
  }
11894
+ /**
11895
+ * Stores the token keys in the cache
11896
+ * @param tokenKeys
11897
+ * @param correlationId
11898
+ * @returns
11899
+ */
11900
+ setTokenKeys(tokenKeys, correlationId) {
11901
+ if (tokenKeys.idToken.length === 0 &&
11902
+ tokenKeys.accessToken.length === 0 &&
11903
+ tokenKeys.refreshToken.length === 0) {
11904
+ // If no keys left, remove the map
11905
+ this.removeItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
11906
+ return;
11907
+ }
11908
+ else {
11909
+ this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys), correlationId);
11910
+ }
11911
+ }
11815
11912
  /**
11816
11913
  * Adds the given key to the token key map
11817
11914
  * @param key
11818
11915
  * @param type
11819
11916
  */
11820
- addTokenKey(key, type) {
11917
+ addTokenKey(key, type, correlationId) {
11821
11918
  this.logger.trace("BrowserCacheManager addTokenKey called");
11822
11919
  const tokenKeys = this.getTokenKeys();
11823
11920
  switch (type) {
@@ -11828,10 +11925,12 @@ class BrowserCacheManager extends CacheManager {
11828
11925
  }
11829
11926
  break;
11830
11927
  case CredentialType.ACCESS_TOKEN:
11831
- if (tokenKeys.accessToken.indexOf(key) === -1) {
11832
- this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map");
11833
- tokenKeys.accessToken.push(key);
11928
+ const index = tokenKeys.accessToken.indexOf(key);
11929
+ if (index !== -1) {
11930
+ tokenKeys.accessToken.splice(index, 1); // Remove existing key before pushing to the end
11834
11931
  }
11932
+ this.logger.trace(`access token ${index === -1 ? "added to" : "updated in"} map`);
11933
+ tokenKeys.accessToken.push(key);
11835
11934
  break;
11836
11935
  case CredentialType.REFRESH_TOKEN:
11837
11936
  if (tokenKeys.refreshToken.indexOf(key) === -1) {
@@ -11843,16 +11942,15 @@ class BrowserCacheManager extends CacheManager {
11843
11942
  this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
11844
11943
  throw createClientAuthError(unexpectedCredentialType);
11845
11944
  }
11846
- this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
11945
+ this.setTokenKeys(tokenKeys, correlationId);
11847
11946
  }
11848
11947
  /**
11849
11948
  * Removes the given key from the token key map
11850
11949
  * @param key
11851
11950
  * @param type
11852
11951
  */
11853
- removeTokenKey(key, type) {
11952
+ removeTokenKey(key, type, correlationId, tokenKeys = this.getTokenKeys()) {
11854
11953
  this.logger.trace("BrowserCacheManager removeTokenKey called");
11855
- const tokenKeys = this.getTokenKeys();
11856
11954
  switch (type) {
11857
11955
  case CredentialType.ID_TOKEN:
11858
11956
  this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${key} from map`);
@@ -11891,23 +11989,22 @@ class BrowserCacheManager extends CacheManager {
11891
11989
  this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
11892
11990
  throw createClientAuthError(unexpectedCredentialType);
11893
11991
  }
11894
- this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
11992
+ this.setTokenKeys(tokenKeys, correlationId);
11895
11993
  }
11896
11994
  /**
11897
11995
  * generates idToken entity from a string
11898
11996
  * @param idTokenKey
11899
11997
  */
11900
- getIdTokenCredential(idTokenKey) {
11998
+ getIdTokenCredential(idTokenKey, correlationId) {
11901
11999
  const value = this.getItem(idTokenKey);
11902
12000
  if (!value) {
11903
12001
  this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
11904
- this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
12002
+ this.removeIdToken(idTokenKey, correlationId);
11905
12003
  return null;
11906
12004
  }
11907
12005
  const parsedIdToken = this.validateAndParseJson(value);
11908
12006
  if (!parsedIdToken || !isIdTokenEntity(parsedIdToken)) {
11909
12007
  this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
11910
- this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
11911
12008
  return null;
11912
12009
  }
11913
12010
  this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit");
@@ -11917,28 +12014,28 @@ class BrowserCacheManager extends CacheManager {
11917
12014
  * set IdToken credential to the platform cache
11918
12015
  * @param idToken
11919
12016
  */
11920
- setIdTokenCredential(idToken) {
12017
+ setIdTokenCredential(idToken, correlationId) {
11921
12018
  this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
11922
12019
  const idTokenKey = generateCredentialKey(idToken);
11923
- this.setItem(idTokenKey, JSON.stringify(idToken));
11924
- this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);
12020
+ idToken.lastUpdatedAt = Date.now().toString();
12021
+ this.setItem(idTokenKey, JSON.stringify(idToken), correlationId);
12022
+ this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN, correlationId);
11925
12023
  }
11926
12024
  /**
11927
12025
  * generates accessToken entity from a string
11928
12026
  * @param key
11929
12027
  */
11930
- getAccessTokenCredential(accessTokenKey) {
12028
+ getAccessTokenCredential(accessTokenKey, correlationId) {
11931
12029
  const value = this.getItem(accessTokenKey);
11932
12030
  if (!value) {
11933
12031
  this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
11934
- this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
12032
+ this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN, correlationId);
11935
12033
  return null;
11936
12034
  }
11937
12035
  const parsedAccessToken = this.validateAndParseJson(value);
11938
12036
  if (!parsedAccessToken ||
11939
12037
  !isAccessTokenEntity(parsedAccessToken)) {
11940
12038
  this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
11941
- this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
11942
12039
  return null;
11943
12040
  }
11944
12041
  this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit");
@@ -11948,28 +12045,28 @@ class BrowserCacheManager extends CacheManager {
11948
12045
  * set accessToken credential to the platform cache
11949
12046
  * @param accessToken
11950
12047
  */
11951
- setAccessTokenCredential(accessToken) {
12048
+ setAccessTokenCredential(accessToken, correlationId) {
11952
12049
  this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");
11953
12050
  const accessTokenKey = generateCredentialKey(accessToken);
11954
- this.setItem(accessTokenKey, JSON.stringify(accessToken));
11955
- this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
12051
+ accessToken.lastUpdatedAt = Date.now().toString();
12052
+ this.setItem(accessTokenKey, JSON.stringify(accessToken), correlationId);
12053
+ this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN, correlationId);
11956
12054
  }
11957
12055
  /**
11958
12056
  * generates refreshToken entity from a string
11959
12057
  * @param refreshTokenKey
11960
12058
  */
11961
- getRefreshTokenCredential(refreshTokenKey) {
12059
+ getRefreshTokenCredential(refreshTokenKey, correlationId) {
11962
12060
  const value = this.getItem(refreshTokenKey);
11963
12061
  if (!value) {
11964
12062
  this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
11965
- this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
12063
+ this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN, correlationId);
11966
12064
  return null;
11967
12065
  }
11968
12066
  const parsedRefreshToken = this.validateAndParseJson(value);
11969
12067
  if (!parsedRefreshToken ||
11970
12068
  !isRefreshTokenEntity(parsedRefreshToken)) {
11971
12069
  this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
11972
- this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
11973
12070
  return null;
11974
12071
  }
11975
12072
  this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit");
@@ -11979,11 +12076,12 @@ class BrowserCacheManager extends CacheManager {
11979
12076
  * set refreshToken credential to the platform cache
11980
12077
  * @param refreshToken
11981
12078
  */
11982
- setRefreshTokenCredential(refreshToken) {
12079
+ setRefreshTokenCredential(refreshToken, correlationId) {
11983
12080
  this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");
11984
12081
  const refreshTokenKey = generateCredentialKey(refreshToken);
11985
- this.setItem(refreshTokenKey, JSON.stringify(refreshToken));
11986
- this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
12082
+ refreshToken.lastUpdatedAt = Date.now().toString();
12083
+ this.setItem(refreshTokenKey, JSON.stringify(refreshToken), correlationId);
12084
+ this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN, correlationId);
11987
12085
  }
11988
12086
  /**
11989
12087
  * fetch appMetadata entity from the platform cache
@@ -12008,10 +12106,10 @@ class BrowserCacheManager extends CacheManager {
12008
12106
  * set appMetadata entity to the platform cache
12009
12107
  * @param appMetadata
12010
12108
  */
12011
- setAppMetadata(appMetadata) {
12109
+ setAppMetadata(appMetadata, correlationId) {
12012
12110
  this.logger.trace("BrowserCacheManager.setAppMetadata called");
12013
12111
  const appMetadataKey = generateAppMetadataKey(appMetadata);
12014
- this.setItem(appMetadataKey, JSON.stringify(appMetadata));
12112
+ this.setItem(appMetadataKey, JSON.stringify(appMetadata), correlationId);
12015
12113
  }
12016
12114
  /**
12017
12115
  * fetch server telemetry entity from the platform cache
@@ -12037,9 +12135,9 @@ class BrowserCacheManager extends CacheManager {
12037
12135
  * @param serverTelemetryKey
12038
12136
  * @param serverTelemetry
12039
12137
  */
12040
- setServerTelemetry(serverTelemetryKey, serverTelemetry) {
12138
+ setServerTelemetry(serverTelemetryKey, serverTelemetry, correlationId) {
12041
12139
  this.logger.trace("BrowserCacheManager.setServerTelemetry called");
12042
- this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));
12140
+ this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry), correlationId);
12043
12141
  }
12044
12142
  /**
12045
12143
  *
@@ -12097,7 +12195,7 @@ class BrowserCacheManager extends CacheManager {
12097
12195
  /**
12098
12196
  * Gets the active account
12099
12197
  */
12100
- getActiveAccount() {
12198
+ getActiveAccount(correlationId) {
12101
12199
  const activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
12102
12200
  const activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
12103
12201
  if (!activeAccountValueFilters) {
@@ -12111,11 +12209,11 @@ class BrowserCacheManager extends CacheManager {
12111
12209
  }
12112
12210
  const activeAccount = this.getAccountInfoFilteredBy({
12113
12211
  localAccountId: activeAccountValueLocal,
12114
- });
12212
+ }, correlationId);
12115
12213
  if (activeAccount) {
12116
12214
  this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found");
12117
12215
  this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema");
12118
- this.setActiveAccount(activeAccount);
12216
+ this.setActiveAccount(activeAccount, correlationId);
12119
12217
  return activeAccount;
12120
12218
  }
12121
12219
  return null;
@@ -12127,7 +12225,7 @@ class BrowserCacheManager extends CacheManager {
12127
12225
  homeAccountId: activeAccountValueObj.homeAccountId,
12128
12226
  localAccountId: activeAccountValueObj.localAccountId,
12129
12227
  tenantId: activeAccountValueObj.tenantId,
12130
- });
12228
+ }, correlationId);
12131
12229
  }
12132
12230
  this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
12133
12231
  return null;
@@ -12136,7 +12234,7 @@ class BrowserCacheManager extends CacheManager {
12136
12234
  * Sets the active account's localAccountId in cache
12137
12235
  * @param account
12138
12236
  */
12139
- setActiveAccount(account) {
12237
+ setActiveAccount(account, correlationId) {
12140
12238
  const activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
12141
12239
  const activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
12142
12240
  if (account) {
@@ -12145,9 +12243,10 @@ class BrowserCacheManager extends CacheManager {
12145
12243
  homeAccountId: account.homeAccountId,
12146
12244
  localAccountId: account.localAccountId,
12147
12245
  tenantId: account.tenantId,
12246
+ lastUpdatedAt: Date.now().toString(),
12148
12247
  };
12149
- this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));
12150
- this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);
12248
+ this.setItem(activeAccountKey, JSON.stringify(activeAccountValue), correlationId);
12249
+ this.setItem(activeAccountKeyLocal, account.localAccountId, correlationId);
12151
12250
  }
12152
12251
  else {
12153
12252
  this.logger.verbose("setActiveAccount: No account passed, active account not set");
@@ -12179,9 +12278,9 @@ class BrowserCacheManager extends CacheManager {
12179
12278
  * @param throttlingCacheKey
12180
12279
  * @param throttlingCache
12181
12280
  */
12182
- setThrottlingCache(throttlingCacheKey, throttlingCache) {
12281
+ setThrottlingCache(throttlingCacheKey, throttlingCache, correlationId) {
12183
12282
  this.logger.trace("BrowserCacheManager.setThrottlingCache called");
12184
- this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));
12283
+ this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache), correlationId);
12185
12284
  }
12186
12285
  /**
12187
12286
  * Gets cache item with given key.
@@ -12257,10 +12356,10 @@ class BrowserCacheManager extends CacheManager {
12257
12356
  /**
12258
12357
  * Clears all cache entries created by MSAL.
12259
12358
  */
12260
- async clear() {
12359
+ async clear(correlationId) {
12261
12360
  // Removes all accounts and their credentials
12262
- await this.removeAllAccounts();
12263
- this.removeAppMetadata();
12361
+ await this.removeAllAccounts(correlationId);
12362
+ this.removeAppMetadata(correlationId);
12264
12363
  // Remove temp storage first to make sure any cookies are cleared
12265
12364
  this.temporaryCacheStorage.getKeys().forEach((cacheKey) => {
12266
12365
  if (cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
@@ -12286,19 +12385,19 @@ class BrowserCacheManager extends CacheManager {
12286
12385
  async clearTokensAndKeysWithClaims(performanceClient, correlationId) {
12287
12386
  performanceClient.addQueueMeasurement(PerformanceEvents.ClearTokensAndKeysWithClaims, correlationId);
12288
12387
  const tokenKeys = this.getTokenKeys();
12289
- const removedAccessTokens = [];
12388
+ let removedAccessTokens = 0;
12290
12389
  tokenKeys.accessToken.forEach((key) => {
12291
12390
  // if the access token has claims in its key, remove the token key and the token
12292
- const credential = this.getAccessTokenCredential(key);
12391
+ const credential = this.getAccessTokenCredential(key, correlationId);
12293
12392
  if (credential?.requestedClaimsHash &&
12294
12393
  key.includes(credential.requestedClaimsHash.toLowerCase())) {
12295
- removedAccessTokens.push(this.removeAccessToken(key));
12394
+ this.removeAccessToken(key, correlationId);
12395
+ removedAccessTokens++;
12296
12396
  }
12297
12397
  });
12298
- await Promise.all(removedAccessTokens);
12299
12398
  // warn if any access tokens are removed
12300
- if (removedAccessTokens.length > 0) {
12301
- this.logger.warning(`${removedAccessTokens.length} access tokens with claims in the cache keys have been removed from the cache.`);
12399
+ if (removedAccessTokens > 0) {
12400
+ this.logger.warning(`${removedAccessTokens} access tokens with claims in the cache keys have been removed from the cache.`);
12302
12401
  }
12303
12402
  }
12304
12403
  /**
@@ -12573,13 +12672,13 @@ class BrowserCacheManager extends CacheManager {
12573
12672
  /**
12574
12673
  * Updates a credential's cache key if the current cache key is outdated
12575
12674
  */
12576
- updateCredentialCacheKey(currentCacheKey, credential) {
12675
+ updateCredentialCacheKey(currentCacheKey, credential, correlationId) {
12577
12676
  const updatedCacheKey = generateCredentialKey(credential);
12578
12677
  if (currentCacheKey !== updatedCacheKey) {
12579
12678
  const cacheItem = this.getItem(currentCacheKey);
12580
12679
  if (cacheItem) {
12581
12680
  this.browserStorage.removeItem(currentCacheKey);
12582
- this.setItem(updatedCacheKey, cacheItem);
12681
+ this.setItem(updatedCacheKey, cacheItem, correlationId);
12583
12682
  this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
12584
12683
  return updatedCacheKey;
12585
12684
  }
@@ -12614,7 +12713,7 @@ class BrowserCacheManager extends CacheManager {
12614
12713
  idToken: idTokenEntity,
12615
12714
  accessToken: accessTokenEntity,
12616
12715
  };
12617
- return this.saveCacheRecord(cacheRecord);
12716
+ return this.saveCacheRecord(cacheRecord, result.correlationId);
12618
12717
  }
12619
12718
  /**
12620
12719
  * saves a cache record
@@ -12622,9 +12721,9 @@ class BrowserCacheManager extends CacheManager {
12622
12721
  * @param storeInCache {?StoreInCache}
12623
12722
  * @param correlationId {?string} correlation id
12624
12723
  */
12625
- async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
12724
+ async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
12626
12725
  try {
12627
- await super.saveCacheRecord(cacheRecord, storeInCache, correlationId);
12726
+ await super.saveCacheRecord(cacheRecord, correlationId, storeInCache);
12628
12727
  }
12629
12728
  catch (e) {
12630
12729
  if (e instanceof CacheError &&
@@ -12665,22 +12764,24 @@ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
12665
12764
  * @param accountFilter - (Optional) filter to narrow down the accounts returned
12666
12765
  * @returns Array of AccountInfo objects in cache
12667
12766
  */
12668
- function getAllAccounts(logger, browserStorage, isInBrowser, accountFilter) {
12767
+ function getAllAccounts(logger, browserStorage, isInBrowser, correlationId, accountFilter) {
12669
12768
  logger.verbose("getAllAccounts called");
12670
- return isInBrowser ? browserStorage.getAllAccounts(accountFilter) : [];
12769
+ return isInBrowser
12770
+ ? browserStorage.getAllAccounts(correlationId, accountFilter)
12771
+ : [];
12671
12772
  }
12672
12773
  /**
12673
12774
  * Returns the first account found in the cache that matches the account filter passed in.
12674
12775
  * @param accountFilter
12675
12776
  * @returns The first account found in the cache matching the provided filter or null if no account could be found.
12676
12777
  */
12677
- function getAccount(accountFilter, logger, browserStorage) {
12778
+ function getAccount(accountFilter, logger, browserStorage, correlationId) {
12678
12779
  logger.trace("getAccount called");
12679
12780
  if (Object.keys(accountFilter).length === 0) {
12680
12781
  logger.warning("getAccount: No accountFilter provided");
12681
12782
  return null;
12682
12783
  }
12683
- const account = browserStorage.getAccountInfoFilteredBy(accountFilter);
12784
+ const account = browserStorage.getAccountInfoFilteredBy(accountFilter, correlationId);
12684
12785
  if (account) {
12685
12786
  logger.verbose("getAccount: Account matching provided filter found, returning");
12686
12787
  return account;
@@ -12698,7 +12799,7 @@ function getAccount(accountFilter, logger, browserStorage) {
12698
12799
  * @param username
12699
12800
  * @returns The account object stored in MSAL
12700
12801
  */
12701
- function getAccountByUsername(username, logger, browserStorage) {
12802
+ function getAccountByUsername(username, logger, browserStorage, correlationId) {
12702
12803
  logger.trace("getAccountByUsername called");
12703
12804
  if (!username) {
12704
12805
  logger.warning("getAccountByUsername: No username provided");
@@ -12706,7 +12807,7 @@ function getAccountByUsername(username, logger, browserStorage) {
12706
12807
  }
12707
12808
  const account = browserStorage.getAccountInfoFilteredBy({
12708
12809
  username,
12709
- });
12810
+ }, correlationId);
12710
12811
  if (account) {
12711
12812
  logger.verbose("getAccountByUsername: Account matching username found, returning");
12712
12813
  logger.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${username}`);
@@ -12724,7 +12825,7 @@ function getAccountByUsername(username, logger, browserStorage) {
12724
12825
  * @param homeAccountId
12725
12826
  * @returns The account object stored in MSAL
12726
12827
  */
12727
- function getAccountByHomeId(homeAccountId, logger, browserStorage) {
12828
+ function getAccountByHomeId(homeAccountId, logger, browserStorage, correlationId) {
12728
12829
  logger.trace("getAccountByHomeId called");
12729
12830
  if (!homeAccountId) {
12730
12831
  logger.warning("getAccountByHomeId: No homeAccountId provided");
@@ -12732,7 +12833,7 @@ function getAccountByHomeId(homeAccountId, logger, browserStorage) {
12732
12833
  }
12733
12834
  const account = browserStorage.getAccountInfoFilteredBy({
12734
12835
  homeAccountId,
12735
- });
12836
+ }, correlationId);
12736
12837
  if (account) {
12737
12838
  logger.verbose("getAccountByHomeId: Account matching homeAccountId found, returning");
12738
12839
  logger.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${homeAccountId}`);
@@ -12750,7 +12851,7 @@ function getAccountByHomeId(homeAccountId, logger, browserStorage) {
12750
12851
  * @param localAccountId
12751
12852
  * @returns The account object stored in MSAL
12752
12853
  */
12753
- function getAccountByLocalId(localAccountId, logger, browserStorage) {
12854
+ function getAccountByLocalId(localAccountId, logger, browserStorage, correlationId) {
12754
12855
  logger.trace("getAccountByLocalId called");
12755
12856
  if (!localAccountId) {
12756
12857
  logger.warning("getAccountByLocalId: No localAccountId provided");
@@ -12758,7 +12859,7 @@ function getAccountByLocalId(localAccountId, logger, browserStorage) {
12758
12859
  }
12759
12860
  const account = browserStorage.getAccountInfoFilteredBy({
12760
12861
  localAccountId,
12761
- });
12862
+ }, correlationId);
12762
12863
  if (account) {
12763
12864
  logger.verbose("getAccountByLocalId: Account matching localAccountId found, returning");
12764
12865
  logger.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${localAccountId}`);
@@ -12773,14 +12874,14 @@ function getAccountByLocalId(localAccountId, logger, browserStorage) {
12773
12874
  * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
12774
12875
  * @param account
12775
12876
  */
12776
- function setActiveAccount(account, browserStorage) {
12777
- browserStorage.setActiveAccount(account);
12877
+ function setActiveAccount(account, browserStorage, correlationId) {
12878
+ browserStorage.setActiveAccount(account, correlationId);
12778
12879
  }
12779
12880
  /**
12780
12881
  * Gets the currently active account
12781
12882
  */
12782
- function getActiveAccount(browserStorage) {
12783
- return browserStorage.getActiveAccount();
12883
+ function getActiveAccount(browserStorage, correlationId) {
12884
+ return browserStorage.getActiveAccount(correlationId);
12784
12885
  }
12785
12886
 
12786
12887
  /*
@@ -12898,13 +12999,13 @@ class BaseInteractionClient {
12898
12999
  }
12899
13000
  async clearCacheOnLogout(account) {
12900
13001
  if (account) {
12901
- if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {
13002
+ if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(this.correlationId), false)) {
12902
13003
  this.logger.verbose("Setting active account to null");
12903
- this.browserStorage.setActiveAccount(null);
13004
+ this.browserStorage.setActiveAccount(null, this.correlationId);
12904
13005
  }
12905
13006
  // Clear given account.
12906
13007
  try {
12907
- await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account));
13008
+ await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account), this.correlationId);
12908
13009
  this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.");
12909
13010
  }
12910
13011
  catch (error) {
@@ -12915,7 +13016,7 @@ class BaseInteractionClient {
12915
13016
  try {
12916
13017
  this.logger.verbose("No account provided in logout request, clearing all cache items.", this.correlationId);
12917
13018
  // Clear all accounts and tokens
12918
- await this.browserStorage.clear();
13019
+ await this.browserStorage.clear(this.correlationId);
12919
13020
  // Clear any stray keys from IndexedDB
12920
13021
  await this.browserCrypto.clearKeystore();
12921
13022
  }
@@ -13309,7 +13410,8 @@ class StandardInteractionClient extends BaseInteractionClient {
13309
13410
  if (request.loginHint || request.sid) {
13310
13411
  return validatedRequest;
13311
13412
  }
13312
- const account = request.account || this.browserStorage.getActiveAccount();
13413
+ const account = request.account ||
13414
+ this.browserStorage.getActiveAccount(this.correlationId);
13313
13415
  if (account) {
13314
13416
  this.logger.verbose("Setting validated request account", this.correlationId);
13315
13417
  this.logger.verbosePii(`Setting validated request account: ${account.homeAccountId}`, this.correlationId);
@@ -13582,7 +13684,7 @@ class NativeInteractionClient extends BaseInteractionClient {
13582
13684
  // fetch the account from browser cache
13583
13685
  const account = this.browserStorage.getBaseAccountInfo({
13584
13686
  nativeAccountId,
13585
- });
13687
+ }, request.correlationId);
13586
13688
  if (!account) {
13587
13689
  throw createClientAuthError(noAccountFound);
13588
13690
  }
@@ -13709,7 +13811,7 @@ class NativeInteractionClient extends BaseInteractionClient {
13709
13811
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
13710
13812
  const cachedhomeAccountId = this.browserStorage.getAccountInfoFilteredBy({
13711
13813
  nativeAccountId: request.accountId,
13712
- })?.homeAccountId;
13814
+ }, this.correlationId)?.homeAccountId;
13713
13815
  if (homeAccountIdentifier !== cachedhomeAccountId &&
13714
13816
  response.account.id !== request.accountId) {
13715
13817
  // User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
@@ -13719,7 +13821,7 @@ class NativeInteractionClient extends BaseInteractionClient {
13719
13821
  const authority = await this.getDiscoveredAuthority({
13720
13822
  requestAuthority: request.authority,
13721
13823
  });
13722
- const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
13824
+ const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, this.correlationId, idTokenClaims, response.client_info, undefined, // environment
13723
13825
  idTokenClaims.tid, undefined, // auth code payload
13724
13826
  response.account.id, this.logger);
13725
13827
  // generate authenticationResult
@@ -13852,9 +13954,11 @@ class NativeInteractionClient extends BaseInteractionClient {
13852
13954
  */
13853
13955
  cacheAccount(accountEntity) {
13854
13956
  // Store the account info and hence `nativeAccountId` in browser cache
13855
- this.browserStorage.setAccount(accountEntity);
13957
+ this.browserStorage.setAccount(accountEntity, this.correlationId);
13856
13958
  // Remove any existing cached tokens for this account in browser storage
13857
- this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
13959
+ this.browserStorage
13960
+ .removeAccountContext(accountEntity, this.correlationId)
13961
+ .catch((e) => {
13858
13962
  this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);
13859
13963
  });
13860
13964
  }
@@ -13883,7 +13987,7 @@ class NativeInteractionClient extends BaseInteractionClient {
13883
13987
  idToken: cachedIdToken,
13884
13988
  accessToken: cachedAccessToken,
13885
13989
  };
13886
- void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13990
+ void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.correlationId, request.storeInCache);
13887
13991
  }
13888
13992
  addTelemetryFromNativeResponse(response) {
13889
13993
  const mats = this.getMATSFromResponse(response);
@@ -14659,7 +14763,7 @@ class PopupClient extends StandardInteractionClient {
14659
14763
  if (validRequest.account?.homeAccountId &&
14660
14764
  validRequest.postLogoutRedirectUri &&
14661
14765
  authClient.authority.protocolMode === ProtocolMode.OIDC) {
14662
- void this.browserStorage.removeAccount(validRequest.account?.homeAccountId);
14766
+ void this.browserStorage.removeAccount(validRequest.account?.homeAccountId, this.correlationId);
14663
14767
  this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
14664
14768
  if (mainWindowRedirectUri) {
14665
14769
  const navigationOptions = {
@@ -15334,7 +15438,7 @@ class RedirectClient extends StandardInteractionClient {
15334
15438
  }
15335
15439
  catch {
15336
15440
  if (validLogoutRequest.account?.homeAccountId) {
15337
- void this.browserStorage.removeAccount(validLogoutRequest.account?.homeAccountId);
15441
+ void this.browserStorage.removeAccount(validLogoutRequest.account?.homeAccountId, this.correlationId);
15338
15442
  this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Redirect, validLogoutRequest);
15339
15443
  return;
15340
15444
  }
@@ -15734,6 +15838,7 @@ class TokenCache {
15734
15838
  if (!this.isBrowserEnvironment) {
15735
15839
  throw createBrowserAuthError(nonBrowserEnvironment);
15736
15840
  }
15841
+ const correlationId = request.correlationId || createNewGuid();
15737
15842
  const idTokenClaims = response.id_token
15738
15843
  ? extractTokenClaims(response.id_token, base64Decode)
15739
15844
  : undefined;
@@ -15747,10 +15852,10 @@ class TokenCache {
15747
15852
  const authority = request.authority
15748
15853
  ? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
15749
15854
  : undefined;
15750
- const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
15751
- const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
15752
- const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
15753
- const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
15855
+ const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", correlationId, idTokenClaims, authority);
15856
+ const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, correlationId);
15857
+ const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options, correlationId);
15858
+ const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, correlationId);
15754
15859
  return this.generateAuthenticationResult(request, {
15755
15860
  account: cacheRecordAccount,
15756
15861
  idToken,
@@ -15767,11 +15872,11 @@ class TokenCache {
15767
15872
  * @param requestHomeAccountId
15768
15873
  * @returns `AccountEntity`
15769
15874
  */
15770
- loadAccount(request, clientInfo, idTokenClaims, authority) {
15875
+ loadAccount(request, clientInfo, correlationId, idTokenClaims, authority) {
15771
15876
  this.logger.verbose("TokenCache - loading account");
15772
15877
  if (request.account) {
15773
15878
  const accountEntity = AccountEntity.createFromAccountInfo(request.account);
15774
- this.storage.setAccount(accountEntity);
15879
+ this.storage.setAccount(accountEntity, correlationId);
15775
15880
  return accountEntity;
15776
15881
  }
15777
15882
  else if (!authority || (!clientInfo && !idTokenClaims)) {
@@ -15780,10 +15885,10 @@ class TokenCache {
15780
15885
  }
15781
15886
  const homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15782
15887
  const claimsTenantId = idTokenClaims?.tid;
15783
- const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15888
+ const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15784
15889
  undefined, // nativeAccountId
15785
15890
  this.logger);
15786
- this.storage.setAccount(cachedAccount);
15891
+ this.storage.setAccount(cachedAccount, correlationId);
15787
15892
  return cachedAccount;
15788
15893
  }
15789
15894
  /**
@@ -15794,14 +15899,14 @@ class TokenCache {
15794
15899
  * @param tenantId
15795
15900
  * @returns `IdTokenEntity`
15796
15901
  */
15797
- loadIdToken(response, homeAccountId, environment, tenantId) {
15902
+ loadIdToken(response, homeAccountId, environment, tenantId, correlationId) {
15798
15903
  if (!response.id_token) {
15799
15904
  this.logger.verbose("TokenCache - no id token found in response");
15800
15905
  return null;
15801
15906
  }
15802
15907
  this.logger.verbose("TokenCache - loading id token");
15803
15908
  const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
15804
- this.storage.setIdTokenCredential(idTokenEntity);
15909
+ this.storage.setIdTokenCredential(idTokenEntity, correlationId);
15805
15910
  return idTokenEntity;
15806
15911
  }
15807
15912
  /**
@@ -15813,7 +15918,7 @@ class TokenCache {
15813
15918
  * @param tenantId
15814
15919
  * @returns `AccessTokenEntity`
15815
15920
  */
15816
- loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
15921
+ loadAccessToken(request, response, homeAccountId, environment, tenantId, options, correlationId) {
15817
15922
  if (!response.access_token) {
15818
15923
  this.logger.verbose("TokenCache - no access token found in response");
15819
15924
  return null;
@@ -15837,7 +15942,7 @@ class TokenCache {
15837
15942
  (response.ext_expires_in || response.expires_in) +
15838
15943
  new Date().getTime() / 1000;
15839
15944
  const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
15840
- this.storage.setAccessTokenCredential(accessTokenEntity);
15945
+ this.storage.setAccessTokenCredential(accessTokenEntity, correlationId);
15841
15946
  return accessTokenEntity;
15842
15947
  }
15843
15948
  /**
@@ -15848,7 +15953,7 @@ class TokenCache {
15848
15953
  * @param environment
15849
15954
  * @returns `RefreshTokenEntity`
15850
15955
  */
15851
- loadRefreshToken(response, homeAccountId, environment) {
15956
+ loadRefreshToken(response, homeAccountId, environment, correlationId) {
15852
15957
  if (!response.refresh_token) {
15853
15958
  this.logger.verbose("TokenCache - no refresh token found in response");
15854
15959
  return null;
@@ -15856,7 +15961,7 @@ class TokenCache {
15856
15961
  this.logger.verbose("TokenCache - loading refresh token");
15857
15962
  const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
15858
15963
  response.refresh_token_expires_in);
15859
- this.storage.setRefreshTokenCredential(refreshTokenEntity);
15964
+ this.storage.setRefreshTokenCredential(refreshTokenEntity, correlationId);
15860
15965
  return refreshTokenEntity;
15861
15966
  }
15862
15967
  /**
@@ -16765,7 +16870,8 @@ class StandardController {
16765
16870
  * @returns Array of AccountInfo objects in cache
16766
16871
  */
16767
16872
  getAllAccounts(accountFilter) {
16768
- return getAllAccounts(this.logger, this.browserStorage, this.isBrowserEnvironment, accountFilter);
16873
+ const correlationId = this.getRequestCorrelationId();
16874
+ return getAllAccounts(this.logger, this.browserStorage, this.isBrowserEnvironment, correlationId, accountFilter);
16769
16875
  }
16770
16876
  /**
16771
16877
  * Returns the first account found in the cache that matches the account filter passed in.
@@ -16773,7 +16879,8 @@ class StandardController {
16773
16879
  * @returns The first account found in the cache matching the provided filter or null if no account could be found.
16774
16880
  */
16775
16881
  getAccount(accountFilter) {
16776
- return getAccount(accountFilter, this.logger, this.browserStorage);
16882
+ const correlationId = this.getRequestCorrelationId();
16883
+ return getAccount(accountFilter, this.logger, this.browserStorage, correlationId);
16777
16884
  }
16778
16885
  /**
16779
16886
  * Returns the signed in account matching username.
@@ -16784,7 +16891,8 @@ class StandardController {
16784
16891
  * @returns The account object stored in MSAL
16785
16892
  */
16786
16893
  getAccountByUsername(username) {
16787
- return getAccountByUsername(username, this.logger, this.browserStorage);
16894
+ const correlationId = this.getRequestCorrelationId();
16895
+ return getAccountByUsername(username, this.logger, this.browserStorage, correlationId);
16788
16896
  }
16789
16897
  /**
16790
16898
  * Returns the signed in account matching homeAccountId.
@@ -16794,7 +16902,8 @@ class StandardController {
16794
16902
  * @returns The account object stored in MSAL
16795
16903
  */
16796
16904
  getAccountByHomeId(homeAccountId) {
16797
- return getAccountByHomeId(homeAccountId, this.logger, this.browserStorage);
16905
+ const correlationId = this.getRequestCorrelationId();
16906
+ return getAccountByHomeId(homeAccountId, this.logger, this.browserStorage, correlationId);
16798
16907
  }
16799
16908
  /**
16800
16909
  * Returns the signed in account matching localAccountId.
@@ -16804,20 +16913,23 @@ class StandardController {
16804
16913
  * @returns The account object stored in MSAL
16805
16914
  */
16806
16915
  getAccountByLocalId(localAccountId) {
16807
- return getAccountByLocalId(localAccountId, this.logger, this.browserStorage);
16916
+ const correlationId = this.getRequestCorrelationId();
16917
+ return getAccountByLocalId(localAccountId, this.logger, this.browserStorage, correlationId);
16808
16918
  }
16809
16919
  /**
16810
16920
  * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
16811
16921
  * @param account
16812
16922
  */
16813
16923
  setActiveAccount(account) {
16814
- setActiveAccount(account, this.browserStorage);
16924
+ const correlationId = this.getRequestCorrelationId();
16925
+ setActiveAccount(account, this.browserStorage, correlationId);
16815
16926
  }
16816
16927
  /**
16817
16928
  * Gets the currently active account
16818
16929
  */
16819
16930
  getActiveAccount() {
16820
- return getActiveAccount(this.browserStorage);
16931
+ const correlationId = this.getRequestCorrelationId();
16932
+ return getActiveAccount(this.browserStorage, correlationId);
16821
16933
  }
16822
16934
  // #endregion
16823
16935
  /**
@@ -16830,7 +16942,7 @@ class StandardController {
16830
16942
  this.logger.verbose("hydrateCache called");
16831
16943
  // Account gets saved to browser storage regardless of native or not
16832
16944
  const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
16833
- this.browserStorage.setAccount(accountEntity);
16945
+ this.browserStorage.setAccount(accountEntity, result.correlationId);
16834
16946
  if (result.fromNativeBroker) {
16835
16947
  this.logger.verbose("Response was from native broker, storing in-memory");
16836
16948
  // Tokens from native broker are stored in-memory
@@ -17614,8 +17726,9 @@ class NestedAppAuthController {
17614
17726
  // Set the active account if available
17615
17727
  const accountContext = this.bridgeProxy.getAccountContext();
17616
17728
  if (accountContext) {
17617
- const cachedAccount = getAccount(accountContext, this.logger, this.browserStorage);
17618
- setActiveAccount(cachedAccount, this.browserStorage);
17729
+ const correlationId = createNewGuid();
17730
+ const cachedAccount = getAccount(accountContext, this.logger, this.browserStorage, correlationId);
17731
+ setActiveAccount(cachedAccount, this.browserStorage, correlationId);
17619
17732
  }
17620
17733
  }
17621
17734
  /**
@@ -17668,7 +17781,7 @@ class NestedAppAuthController {
17668
17781
  };
17669
17782
  // cache the tokens in the response
17670
17783
  await this.hydrateCache(result, request);
17671
- this.browserStorage.setActiveAccount(result.account);
17784
+ this.browserStorage.setActiveAccount(result.account, result.correlationId);
17672
17785
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
17673
17786
  atPopupMeasurement.add({
17674
17787
  accessTokenSize: result.accessToken.length,
@@ -17718,7 +17831,7 @@ class NestedAppAuthController {
17718
17831
  const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
17719
17832
  // cache the tokens in the response
17720
17833
  await this.hydrateCache(result, request);
17721
- this.browserStorage.setActiveAccount(result.account);
17834
+ this.browserStorage.setActiveAccount(result.account, result.correlationId);
17722
17835
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, result);
17723
17836
  ssoSilentMeasurement?.add({
17724
17837
  accessTokenSize: result.accessToken.length,
@@ -17789,10 +17902,11 @@ class NestedAppAuthController {
17789
17902
  * @returns
17790
17903
  */
17791
17904
  async acquireTokenFromCacheInternal(request) {
17905
+ const correlationId = request.correlationId || createNewGuid();
17792
17906
  const accountContext = this.bridgeProxy.getAccountContext();
17793
17907
  let currentAccount = null;
17794
17908
  if (accountContext) {
17795
- const hubAccount = getAccount(accountContext, this.logger, this.browserStorage);
17909
+ const hubAccount = getAccount(accountContext, this.logger, this.browserStorage, correlationId);
17796
17910
  // always prioritize for hub account context, the reqirement of `request.account` will be removed soon
17797
17911
  currentAccount = hubAccount || request.account;
17798
17912
  }
@@ -17804,7 +17918,7 @@ class NestedAppAuthController {
17804
17918
  this.logger.verbose("active account found, attempting to acquire token silently");
17805
17919
  const authRequest = {
17806
17920
  ...request,
17807
- correlationId: request.correlationId || this.browserCrypto.createNewGuid(),
17921
+ correlationId: correlationId,
17808
17922
  authority: request.authority || currentAccount.environment,
17809
17923
  scopes: request.scopes?.length
17810
17924
  ? request.scopes
@@ -17812,7 +17926,7 @@ class NestedAppAuthController {
17812
17926
  };
17813
17927
  // fetch access token and check for expiry
17814
17928
  const tokenKeys = this.browserStorage.getTokenKeys();
17815
- const cachedAccessToken = this.browserStorage.getAccessToken(currentAccount, authRequest, tokenKeys, currentAccount.tenantId, this.performanceClient, authRequest.correlationId);
17929
+ const cachedAccessToken = this.browserStorage.getAccessToken(currentAccount, authRequest, tokenKeys, currentAccount.tenantId, this.performanceClient);
17816
17930
  // If there is no access token, log it and return null
17817
17931
  if (!cachedAccessToken) {
17818
17932
  this.logger.verbose("No cached access token found");
@@ -17823,7 +17937,7 @@ class NestedAppAuthController {
17823
17937
  this.logger.verbose("Cached access token has expired");
17824
17938
  return Promise.resolve(null);
17825
17939
  }
17826
- const cachedIdToken = this.browserStorage.getIdToken(currentAccount, tokenKeys, currentAccount.tenantId, this.performanceClient, authRequest.correlationId);
17940
+ const cachedIdToken = this.browserStorage.getIdToken(currentAccount, authRequest.correlationId, tokenKeys, currentAccount.tenantId, this.performanceClient);
17827
17941
  if (!cachedIdToken) {
17828
17942
  this.logger.verbose("No cached id token found");
17829
17943
  return Promise.resolve(null);
@@ -17920,7 +18034,8 @@ class NestedAppAuthController {
17920
18034
  * @returns Array of AccountInfo objects in cache
17921
18035
  */
17922
18036
  getAllAccounts(accountFilter) {
17923
- return getAllAccounts(this.logger, this.browserStorage, this.isBrowserEnv(), accountFilter);
18037
+ const correlationId = createNewGuid();
18038
+ return getAllAccounts(this.logger, this.browserStorage, this.isBrowserEnv(), correlationId, accountFilter);
17924
18039
  }
17925
18040
  /**
17926
18041
  * Returns the first account found in the cache that matches the account filter passed in.
@@ -17928,7 +18043,8 @@ class NestedAppAuthController {
17928
18043
  * @returns The first account found in the cache matching the provided filter or null if no account could be found.
17929
18044
  */
17930
18045
  getAccount(accountFilter) {
17931
- return getAccount(accountFilter, this.logger, this.browserStorage);
18046
+ const correlationId = createNewGuid();
18047
+ return getAccount(accountFilter, this.logger, this.browserStorage, correlationId);
17932
18048
  }
17933
18049
  /**
17934
18050
  * Returns the signed in account matching username.
@@ -17939,7 +18055,8 @@ class NestedAppAuthController {
17939
18055
  * @returns The account object stored in MSAL
17940
18056
  */
17941
18057
  getAccountByUsername(username) {
17942
- return getAccountByUsername(username, this.logger, this.browserStorage);
18058
+ const correlationId = createNewGuid();
18059
+ return getAccountByUsername(username, this.logger, this.browserStorage, correlationId);
17943
18060
  }
17944
18061
  /**
17945
18062
  * Returns the signed in account matching homeAccountId.
@@ -17949,7 +18066,8 @@ class NestedAppAuthController {
17949
18066
  * @returns The account object stored in MSAL
17950
18067
  */
17951
18068
  getAccountByHomeId(homeAccountId) {
17952
- return getAccountByHomeId(homeAccountId, this.logger, this.browserStorage);
18069
+ const correlationId = createNewGuid();
18070
+ return getAccountByHomeId(homeAccountId, this.logger, this.browserStorage, correlationId);
17953
18071
  }
17954
18072
  /**
17955
18073
  * Returns the signed in account matching localAccountId.
@@ -17959,7 +18077,8 @@ class NestedAppAuthController {
17959
18077
  * @returns The account object stored in MSAL
17960
18078
  */
17961
18079
  getAccountByLocalId(localAccountId) {
17962
- return getAccountByLocalId(localAccountId, this.logger, this.browserStorage);
18080
+ const correlationId = createNewGuid();
18081
+ return getAccountByLocalId(localAccountId, this.logger, this.browserStorage, correlationId);
17963
18082
  }
17964
18083
  /**
17965
18084
  * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
@@ -17970,13 +18089,15 @@ class NestedAppAuthController {
17970
18089
  * StandardController uses this to allow the developer to set the active account
17971
18090
  * in the nested app auth scenario the active account is controlled by the app hosting the nested app
17972
18091
  */
17973
- return setActiveAccount(account, this.browserStorage);
18092
+ const correlationId = createNewGuid();
18093
+ return setActiveAccount(account, this.browserStorage, correlationId);
17974
18094
  }
17975
18095
  /**
17976
18096
  * Gets the currently active account
17977
18097
  */
17978
18098
  getActiveAccount() {
17979
- return getActiveAccount(this.browserStorage);
18099
+ const correlationId = createNewGuid();
18100
+ return getActiveAccount(this.browserStorage, correlationId);
17980
18101
  }
17981
18102
  // #endregion
17982
18103
  handleRedirectPromise(hash // eslint-disable-line @typescript-eslint/no-unused-vars
@@ -18058,7 +18179,7 @@ class NestedAppAuthController {
18058
18179
  async hydrateCache(result, request) {
18059
18180
  this.logger.verbose("hydrateCache called");
18060
18181
  const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
18061
- this.browserStorage.setAccount(accountEntity);
18182
+ this.browserStorage.setAccount(accountEntity, result.correlationId);
18062
18183
  return this.browserStorage.hydrateCache(result, request);
18063
18184
  }
18064
18185
  }