@azure/msal-node 5.1.1 → 5.1.2

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 (55) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.mjs +1 -1
  3. package/dist/cache/TokenCache.mjs +1 -1
  4. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  5. package/dist/cache/serializer/Deserializer.mjs +1 -1
  6. package/dist/cache/serializer/Serializer.mjs +1 -1
  7. package/dist/client/BaseClient.mjs +1 -1
  8. package/dist/client/ClientApplication.mjs +1 -1
  9. package/dist/client/ClientAssertion.mjs +1 -1
  10. package/dist/client/ClientCredentialClient.mjs +1 -1
  11. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  12. package/dist/client/DeviceCodeClient.mjs +1 -1
  13. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  14. package/dist/client/ManagedIdentityClient.mjs +1 -1
  15. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  22. package/dist/client/OnBehalfOfClient.mjs +1 -1
  23. package/dist/client/PublicClientApplication.mjs +1 -1
  24. package/dist/client/UsernamePasswordClient.mjs +1 -1
  25. package/dist/config/Configuration.mjs +1 -1
  26. package/dist/config/ManagedIdentityId.mjs +1 -1
  27. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  28. package/dist/crypto/CryptoProvider.mjs +1 -1
  29. package/dist/crypto/GuidGenerator.mjs +1 -1
  30. package/dist/crypto/HashUtils.mjs +1 -1
  31. package/dist/crypto/PkceGenerator.mjs +1 -1
  32. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  33. package/dist/error/ManagedIdentityError.mjs +1 -1
  34. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  35. package/dist/error/NodeAuthError.mjs +1 -1
  36. package/dist/index.mjs +1 -1
  37. package/dist/internals.mjs +1 -1
  38. package/dist/network/HttpClient.mjs +1 -1
  39. package/dist/network/HttpClientWithRetries.mjs +1 -1
  40. package/dist/network/LoopbackClient.mjs +1 -1
  41. package/dist/packageMetadata.d.ts +1 -1
  42. package/dist/packageMetadata.mjs +2 -2
  43. package/dist/protocol/Authorize.mjs +1 -1
  44. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  45. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  46. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  47. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  48. package/dist/utils/Constants.mjs +1 -1
  49. package/dist/utils/EncodingUtils.mjs +1 -1
  50. package/dist/utils/TimeUtils.mjs +1 -1
  51. package/lib/msal-node.cjs +498 -491
  52. package/lib/msal-node.cjs.map +1 -1
  53. package/lib/types/packageMetadata.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/src/packageMetadata.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v5.1.1 2026-03-18 */
1
+ /*! @azure/msal-node v5.1.2 2026-04-01 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -150,7 +150,7 @@ class Serializer {
150
150
  }
151
151
  }
152
152
 
153
- /*! @azure/msal-common v16.4.0 2026-03-18 */
153
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
154
154
  /*
155
155
  * Copyright (c) Microsoft Corporation. All rights reserved.
156
156
  * Licensed under the MIT License.
@@ -398,7 +398,7 @@ const EncodingTypes = {
398
398
  UTF8: "utf-8",
399
399
  };
400
400
 
401
- /*! @azure/msal-common v16.4.0 2026-03-18 */
401
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
402
402
  /*
403
403
  * Copyright (c) Microsoft Corporation. All rights reserved.
404
404
  * Licensed under the MIT License.
@@ -451,7 +451,7 @@ const INSTANCE_AWARE = "instance_aware";
451
451
  const RESOURCE = "resource";
452
452
  const CLI_DATA = "clidata";
453
453
 
454
- /*! @azure/msal-common v16.4.0 2026-03-18 */
454
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
455
455
  /*
456
456
  * Copyright (c) Microsoft Corporation. All rights reserved.
457
457
  * Licensed under the MIT License.
@@ -482,7 +482,7 @@ function createAuthError(code, additionalMessage) {
482
482
  return new AuthError(code, additionalMessage || getDefaultErrorMessage(code));
483
483
  }
484
484
 
485
- /*! @azure/msal-common v16.4.0 2026-03-18 */
485
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
486
486
 
487
487
  /*
488
488
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -502,7 +502,7 @@ function createClientConfigurationError(errorCode) {
502
502
  return new ClientConfigurationError(errorCode);
503
503
  }
504
504
 
505
- /*! @azure/msal-common v16.4.0 2026-03-18 */
505
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
506
506
  /*
507
507
  * Copyright (c) Microsoft Corporation. All rights reserved.
508
508
  * Licensed under the MIT License.
@@ -582,7 +582,7 @@ class StringUtils {
582
582
  }
583
583
  }
584
584
 
585
- /*! @azure/msal-common v16.4.0 2026-03-18 */
585
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
586
586
 
587
587
  /*
588
588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -605,7 +605,7 @@ function createClientAuthError(errorCode, additionalMessage) {
605
605
  return new ClientAuthError(errorCode, additionalMessage);
606
606
  }
607
607
 
608
- /*! @azure/msal-common v16.4.0 2026-03-18 */
608
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
609
609
  /*
610
610
  * Copyright (c) Microsoft Corporation. All rights reserved.
611
611
  * Licensed under the MIT License.
@@ -659,7 +659,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
659
659
  urlParseError: urlParseError
660
660
  });
661
661
 
662
- /*! @azure/msal-common v16.4.0 2026-03-18 */
662
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
663
663
  /*
664
664
  * Copyright (c) Microsoft Corporation. All rights reserved.
665
665
  * Licensed under the MIT License.
@@ -747,7 +747,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
747
747
  userCanceled: userCanceled
748
748
  });
749
749
 
750
- /*! @azure/msal-common v16.4.0 2026-03-18 */
750
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
751
751
 
752
752
  /*
753
753
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -942,7 +942,7 @@ class ScopeSet {
942
942
  }
943
943
  }
944
944
 
945
- /*! @azure/msal-common v16.4.0 2026-03-18 */
945
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
946
946
 
947
947
  /*
948
948
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1338,7 +1338,7 @@ function addResource(parameters, resource) {
1338
1338
  }
1339
1339
  }
1340
1340
 
1341
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1341
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1342
1342
  /**
1343
1343
  * Parses hash string from given string. Returns empty string if no hash symbol is found.
1344
1344
  * @param hashString
@@ -1391,7 +1391,7 @@ function mapToQueryString(parameters) {
1391
1391
  return queryParameterArray.join("&");
1392
1392
  }
1393
1393
 
1394
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1394
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1395
1395
 
1396
1396
  /*
1397
1397
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1430,7 +1430,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
1430
1430
  },
1431
1431
  };
1432
1432
 
1433
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1433
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1434
1434
  /*
1435
1435
  * Copyright (c) Microsoft Corporation. All rights reserved.
1436
1436
  * Licensed under the MIT License.
@@ -1691,12 +1691,12 @@ class Logger {
1691
1691
  }
1692
1692
  }
1693
1693
 
1694
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1694
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1695
1695
  /* eslint-disable header/header */
1696
1696
  const name$1 = "@azure/msal-common";
1697
- const version$1 = "16.4.0";
1697
+ const version$1 = "16.4.1";
1698
1698
 
1699
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1699
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1700
1700
  /*
1701
1701
  * Copyright (c) Microsoft Corporation. All rights reserved.
1702
1702
  * Licensed under the MIT License.
@@ -1716,7 +1716,7 @@ const AzureCloudInstance = {
1716
1716
  AzureUsGovernment: "https://login.microsoftonline.us",
1717
1717
  };
1718
1718
 
1719
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1719
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1720
1720
  /*
1721
1721
  * Copyright (c) Microsoft Corporation. All rights reserved.
1722
1722
  * Licensed under the MIT License.
@@ -1798,7 +1798,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1798
1798
  return updatedAccountInfo;
1799
1799
  }
1800
1800
 
1801
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1801
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1802
1802
 
1803
1803
  /*
1804
1804
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1878,7 +1878,7 @@ function checkMaxAge(authTime, maxAge) {
1878
1878
  }
1879
1879
  }
1880
1880
 
1881
- /*! @azure/msal-common v16.4.0 2026-03-18 */
1881
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
1882
1882
 
1883
1883
  /*
1884
1884
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2035,7 +2035,7 @@ class UrlString {
2035
2035
  }
2036
2036
  }
2037
2037
 
2038
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2038
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2039
2039
 
2040
2040
  /*
2041
2041
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2192,7 +2192,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2192
2192
  return null;
2193
2193
  }
2194
2194
 
2195
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2195
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2196
2196
  /*
2197
2197
  * Copyright (c) Microsoft Corporation. All rights reserved.
2198
2198
  * Licensed under the MIT License.
@@ -2200,7 +2200,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2200
2200
  const cacheQuotaExceeded = "cache_quota_exceeded";
2201
2201
  const cacheErrorUnknown = "cache_error_unknown";
2202
2202
 
2203
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2203
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2204
2204
 
2205
2205
  /*
2206
2206
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2238,7 +2238,7 @@ function createCacheError(e) {
2238
2238
  }
2239
2239
  }
2240
2240
 
2241
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2241
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2242
2242
 
2243
2243
  /*
2244
2244
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2276,7 +2276,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2276
2276
  };
2277
2277
  }
2278
2278
 
2279
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2279
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2280
2280
  /*
2281
2281
  * Copyright (c) Microsoft Corporation. All rights reserved.
2282
2282
  * Licensed under the MIT License.
@@ -2291,7 +2291,7 @@ const AuthorityType = {
2291
2291
  Ciam: 3,
2292
2292
  };
2293
2293
 
2294
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2294
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2295
2295
  /*
2296
2296
  * Copyright (c) Microsoft Corporation. All rights reserved.
2297
2297
  * Licensed under the MIT License.
@@ -2313,7 +2313,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2313
2313
  return null;
2314
2314
  }
2315
2315
 
2316
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2316
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2317
2317
  /*
2318
2318
  * Copyright (c) Microsoft Corporation. All rights reserved.
2319
2319
  * Licensed under the MIT License.
@@ -2337,7 +2337,7 @@ const ProtocolMode = {
2337
2337
  EAR: "EAR",
2338
2338
  };
2339
2339
 
2340
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2340
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2341
2341
  /**
2342
2342
  * Returns the AccountInfo interface for this account.
2343
2343
  */
@@ -2480,7 +2480,7 @@ function isAccountEntity(entity) {
2480
2480
  entity.hasOwnProperty("authorityType"));
2481
2481
  }
2482
2482
 
2483
- /*! @azure/msal-common v16.4.0 2026-03-18 */
2483
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
2484
2484
 
2485
2485
  /*
2486
2486
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3581,7 +3581,7 @@ class DefaultStorageClass extends CacheManager {
3581
3581
  }
3582
3582
  }
3583
3583
 
3584
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3584
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3585
3585
  /*
3586
3586
  * Copyright (c) Microsoft Corporation. All rights reserved.
3587
3587
  * Licensed under the MIT License.
@@ -3595,7 +3595,7 @@ class DefaultStorageClass extends CacheManager {
3595
3595
  const PerformanceEventStatus = {
3596
3596
  InProgress: 1};
3597
3597
 
3598
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3598
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3599
3599
 
3600
3600
  /*
3601
3601
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3650,7 +3650,7 @@ class StubPerformanceClient {
3650
3650
  }
3651
3651
  }
3652
3652
 
3653
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3653
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3654
3654
 
3655
3655
  /*
3656
3656
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3745,245 +3745,348 @@ function isOidcProtocolMode(config) {
3745
3745
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3746
3746
  }
3747
3747
 
3748
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3749
-
3748
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3750
3749
  /*
3751
3750
  * Copyright (c) Microsoft Corporation. All rights reserved.
3752
3751
  * Licensed under the MIT License.
3753
3752
  */
3754
3753
  /**
3755
- * Error thrown when there is an error with the server code, for example, unavailability.
3756
- */
3757
- class ServerError extends AuthError {
3758
- constructor(errorCode, errorMessage, subError, errorNo, status) {
3759
- super(errorCode, errorMessage, subError);
3760
- this.name = "ServerError";
3761
- this.errorNo = errorNo;
3762
- this.status = status;
3763
- Object.setPrototypeOf(this, ServerError.prototype);
3754
+ * This class instance helps track the memory changes facilitating
3755
+ * decisions to read from and write to the persistent cache
3756
+ */ class TokenCacheContext {
3757
+ constructor(tokenCache, hasChanged) {
3758
+ this.cache = tokenCache;
3759
+ this.hasChanged = hasChanged;
3760
+ }
3761
+ /**
3762
+ * boolean which indicates the changes in cache
3763
+ */
3764
+ get cacheHasChanged() {
3765
+ return this.hasChanged;
3766
+ }
3767
+ /**
3768
+ * function to retrieve the token cache
3769
+ */
3770
+ get tokenCache() {
3771
+ return this.cache;
3764
3772
  }
3765
3773
  }
3766
3774
 
3767
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3775
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3768
3776
  /*
3769
3777
  * Copyright (c) Microsoft Corporation. All rights reserved.
3770
3778
  * Licensed under the MIT License.
3771
3779
  */
3772
3780
  /**
3773
- * MSAL-defined interaction required error code indicating no tokens are found in cache.
3774
- * @public
3775
- */
3776
- const noTokensFound = "no_tokens_found";
3777
- /**
3778
- * MSAL-defined error code indicating a native account is unavailable on the platform.
3779
- * @public
3780
- */
3781
- const nativeAccountUnavailable = "native_account_unavailable";
3782
- /**
3783
- * MSAL-defined error code indicating the refresh token has expired and user interaction is needed.
3784
- * @public
3785
- */
3786
- const refreshTokenExpired = "refresh_token_expired";
3787
- /**
3788
- * MSAL-defined error code indicating UI/UX is not allowed (e.g., blocked by policy), requiring alternate interaction.
3789
- * @public
3781
+ * Utility functions for managing date and time operations.
3790
3782
  */
3791
- const uxNotAllowed = "ux_not_allowed";
3792
3783
  /**
3793
- * Server-originated error code indicating interaction is required to complete the request.
3794
- * @public
3784
+ * return the current time in Unix time (seconds).
3795
3785
  */
3796
- const interactionRequired = "interaction_required";
3786
+ function nowSeconds() {
3787
+ // Date.getTime() returns in milliseconds.
3788
+ return Math.round(new Date().getTime() / 1000.0);
3789
+ }
3797
3790
  /**
3798
- * Server-originated error code indicating user consent is required.
3799
- * @public
3791
+ * Convert seconds to JS Date object. Seconds can be in a number or string format or undefined (will still return a date).
3792
+ * @param seconds
3800
3793
  */
3801
- const consentRequired = "consent_required";
3794
+ function toDateFromSeconds(seconds) {
3795
+ if (seconds) {
3796
+ return new Date(Number(seconds) * 1000);
3797
+ }
3798
+ return new Date();
3799
+ }
3802
3800
  /**
3803
- * Server-originated error code indicating user login is required.
3804
- * @public
3801
+ * check if a token is expired based on given UTC time in seconds.
3802
+ * @param expiresOn
3805
3803
  */
3806
- const loginRequired = "login_required";
3804
+ function isTokenExpired(expiresOn, offset) {
3805
+ // check for access token expiry
3806
+ const expirationSec = Number(expiresOn) || 0;
3807
+ const offsetCurrentTimeSec = nowSeconds() + offset;
3808
+ // If current time + offset is greater than token expiration time, then token is expired.
3809
+ return offsetCurrentTimeSec > expirationSec;
3810
+ }
3807
3811
  /**
3808
- * Server-originated error code indicating the token is invalid or corrupted.
3809
- * @public
3812
+ * If the current time is earlier than the time that a token was cached at, we must discard the token
3813
+ * i.e. The system clock was turned back after acquiring the cached token
3814
+ * @param cachedAt
3815
+ * @param offset
3810
3816
  */
3811
- const badToken = "bad_token";
3817
+ function wasClockTurnedBack(cachedAt) {
3818
+ const cachedAtSec = Number(cachedAt);
3819
+ return cachedAtSec > nowSeconds();
3820
+ }
3812
3821
  /**
3813
- * Server-originated error code indicating the user is in an interrupted state and interaction is required.
3814
- * @public
3822
+ * Waits for t number of milliseconds
3823
+ * @param t number
3824
+ * @param value T
3815
3825
  */
3816
- const interruptedUser = "interrupted_user";
3817
-
3818
- var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
3819
- __proto__: null,
3820
- badToken: badToken,
3821
- consentRequired: consentRequired,
3822
- interactionRequired: interactionRequired,
3823
- interruptedUser: interruptedUser,
3824
- loginRequired: loginRequired,
3825
- nativeAccountUnavailable: nativeAccountUnavailable,
3826
- noTokensFound: noTokensFound,
3827
- refreshTokenExpired: refreshTokenExpired,
3828
- uxNotAllowed: uxNotAllowed
3829
- });
3826
+ function delay(t, value) {
3827
+ return new Promise((resolve) => setTimeout(() => resolve(value), t));
3828
+ }
3830
3829
 
3831
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3830
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3832
3831
 
3833
3832
  /*
3834
3833
  * Copyright (c) Microsoft Corporation. All rights reserved.
3835
3834
  * Licensed under the MIT License.
3836
3835
  */
3837
3836
  /**
3838
- * InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required
3837
+ * Create IdTokenEntity
3838
+ * @param homeAccountId
3839
+ * @param authenticationResult
3840
+ * @param clientId
3841
+ * @param authority
3839
3842
  */
3840
- const InteractionRequiredServerErrorMessage = [
3841
- interactionRequired,
3842
- consentRequired,
3843
- loginRequired,
3844
- badToken,
3845
- uxNotAllowed,
3846
- interruptedUser,
3847
- ];
3848
- const InteractionRequiredAuthSubErrorMessage = [
3849
- "message_only",
3850
- "additional_action",
3851
- "basic_action",
3852
- "user_password_expired",
3853
- "consent_required",
3854
- "bad_token",
3855
- "ux_not_allowed",
3856
- "interrupted_user",
3857
- ];
3843
+ function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
3844
+ const idTokenEntity = {
3845
+ credentialType: CredentialType.ID_TOKEN,
3846
+ homeAccountId: homeAccountId,
3847
+ environment: environment,
3848
+ clientId: clientId,
3849
+ secret: idToken,
3850
+ realm: tenantId,
3851
+ lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
3852
+ };
3853
+ return idTokenEntity;
3854
+ }
3858
3855
  /**
3859
- * Error thrown when user interaction is required.
3856
+ * Create AccessTokenEntity
3857
+ * @param homeAccountId
3858
+ * @param environment
3859
+ * @param accessToken
3860
+ * @param clientId
3861
+ * @param tenantId
3862
+ * @param scopes
3863
+ * @param expiresOn
3864
+ * @param extExpiresOn
3860
3865
  */
3861
- class InteractionRequiredAuthError extends AuthError {
3862
- constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
3863
- super(errorCode, errorMessage, subError);
3864
- Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
3865
- this.timestamp = timestamp || "";
3866
- this.traceId = traceId || "";
3867
- this.correlationId = correlationId || "";
3868
- this.claims = claims || "";
3869
- this.name = "InteractionRequiredAuthError";
3870
- this.errorNo = errorNo;
3866
+ function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId) {
3867
+ const atEntity = {
3868
+ homeAccountId: homeAccountId,
3869
+ credentialType: CredentialType.ACCESS_TOKEN,
3870
+ secret: accessToken,
3871
+ cachedAt: nowSeconds().toString(),
3872
+ expiresOn: expiresOn.toString(),
3873
+ extendedExpiresOn: extExpiresOn.toString(),
3874
+ environment: environment,
3875
+ clientId: clientId,
3876
+ realm: tenantId,
3877
+ target: scopes,
3878
+ tokenType: tokenType || AuthenticationScheme.BEARER,
3879
+ lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
3880
+ };
3881
+ if (userAssertionHash) {
3882
+ atEntity.userAssertionHash = userAssertionHash;
3883
+ }
3884
+ if (refreshOn) {
3885
+ atEntity.refreshOn = refreshOn.toString();
3886
+ }
3887
+ /*
3888
+ * Create Access Token With Auth Scheme instead of regular access token
3889
+ * Cast to lower to handle "bearer" from ADFS
3890
+ */
3891
+ if (atEntity.tokenType?.toLowerCase() !==
3892
+ AuthenticationScheme.BEARER.toLowerCase()) {
3893
+ atEntity.credentialType =
3894
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
3895
+ switch (atEntity.tokenType) {
3896
+ case AuthenticationScheme.POP:
3897
+ // Make sure keyId is present and add it to credential
3898
+ const tokenClaims = extractTokenClaims(accessToken, base64Decode);
3899
+ if (!tokenClaims?.cnf?.kid) {
3900
+ throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
3901
+ }
3902
+ atEntity.keyId = tokenClaims.cnf.kid;
3903
+ break;
3904
+ case AuthenticationScheme.SSH:
3905
+ atEntity.keyId = keyId;
3906
+ }
3871
3907
  }
3908
+ return atEntity;
3872
3909
  }
3873
3910
  /**
3874
- * Helper function used to determine if an error thrown by the server requires interaction to resolve
3875
- * @param errorCode
3876
- * @param errorString
3877
- * @param subError
3911
+ * Create RefreshTokenEntity
3912
+ * @param homeAccountId
3913
+ * @param authenticationResult
3914
+ * @param clientId
3915
+ * @param authority
3878
3916
  */
3879
- function isInteractionRequiredError(errorCode, errorString, subError) {
3880
- const isInteractionRequiredErrorCode = !!errorCode &&
3881
- InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;
3882
- const isInteractionRequiredSubError = !!subError &&
3883
- InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;
3884
- const isInteractionRequiredErrorDesc = !!errorString &&
3885
- InteractionRequiredServerErrorMessage.some((irErrorCode) => {
3886
- return errorString.indexOf(irErrorCode) > -1;
3887
- });
3888
- return (isInteractionRequiredErrorCode ||
3889
- isInteractionRequiredErrorDesc ||
3890
- isInteractionRequiredSubError);
3917
+ function createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {
3918
+ const rtEntity = {
3919
+ credentialType: CredentialType.REFRESH_TOKEN,
3920
+ homeAccountId: homeAccountId,
3921
+ environment: environment,
3922
+ clientId: clientId,
3923
+ secret: refreshToken,
3924
+ lastUpdatedAt: Date.now().toString(),
3925
+ };
3926
+ if (userAssertionHash) {
3927
+ rtEntity.userAssertionHash = userAssertionHash;
3928
+ }
3929
+ if (familyId) {
3930
+ rtEntity.familyId = familyId;
3931
+ }
3932
+ if (expiresOn) {
3933
+ rtEntity.expiresOn = expiresOn.toString();
3934
+ }
3935
+ return rtEntity;
3936
+ }
3937
+ function isCredentialEntity(entity) {
3938
+ return (entity.hasOwnProperty("homeAccountId") &&
3939
+ entity.hasOwnProperty("environment") &&
3940
+ entity.hasOwnProperty("credentialType") &&
3941
+ entity.hasOwnProperty("clientId") &&
3942
+ entity.hasOwnProperty("secret"));
3891
3943
  }
3892
3944
  /**
3893
- * Creates an InteractionRequiredAuthError
3945
+ * Validates an entity: checks for all expected params
3946
+ * @param entity
3894
3947
  */
3895
- function createInteractionRequiredAuthError(errorCode, errorMessage) {
3896
- return new InteractionRequiredAuthError(errorCode, errorMessage);
3897
- }
3898
-
3899
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3948
+ function isAccessTokenEntity(entity) {
3949
+ if (!entity) {
3950
+ return false;
3951
+ }
3952
+ return (isCredentialEntity(entity) &&
3953
+ entity.hasOwnProperty("realm") &&
3954
+ entity.hasOwnProperty("target") &&
3955
+ (entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
3956
+ entity["credentialType"] ===
3957
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
3958
+ }
3900
3959
  /**
3901
- * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
3902
- * @param base64Decode
3903
- * @param state
3960
+ * Validates an entity: checks for all expected params
3961
+ * @param entity
3904
3962
  */
3905
- function parseRequestState(base64Decode, state) {
3906
- if (!base64Decode) {
3907
- throw createClientAuthError(noCryptoObject);
3908
- }
3909
- if (!state) {
3910
- throw createClientAuthError(invalidState);
3963
+ function isIdTokenEntity(entity) {
3964
+ if (!entity) {
3965
+ return false;
3911
3966
  }
3912
- try {
3913
- // Split the state between library state and user passed state and decode them separately
3914
- const splitState = state.split(RESOURCE_DELIM);
3915
- const libraryState = splitState[0];
3916
- const userState = splitState.length > 1
3917
- ? splitState.slice(1).join(RESOURCE_DELIM)
3918
- : "";
3919
- const libraryStateString = base64Decode(libraryState);
3920
- const libraryStateObj = JSON.parse(libraryStateString);
3921
- return {
3922
- userRequestState: userState || "",
3923
- libraryState: libraryStateObj,
3924
- };
3967
+ return (isCredentialEntity(entity) &&
3968
+ entity.hasOwnProperty("realm") &&
3969
+ entity["credentialType"] === CredentialType.ID_TOKEN);
3970
+ }
3971
+ /**
3972
+ * Validates an entity: checks for all expected params
3973
+ * @param entity
3974
+ */
3975
+ function isRefreshTokenEntity(entity) {
3976
+ if (!entity) {
3977
+ return false;
3925
3978
  }
3926
- catch (e) {
3927
- throw createClientAuthError(invalidState);
3979
+ return (isCredentialEntity(entity) &&
3980
+ entity["credentialType"] === CredentialType.REFRESH_TOKEN);
3981
+ }
3982
+ /**
3983
+ * validates if a given cache entry is "Telemetry", parses <key,value>
3984
+ * @param key
3985
+ * @param entity
3986
+ */
3987
+ function isServerTelemetryEntity(key, entity) {
3988
+ const validateKey = key.indexOf(SERVER_TELEM_CACHE_KEY) === 0;
3989
+ let validateEntity = true;
3990
+ if (entity) {
3991
+ validateEntity =
3992
+ entity.hasOwnProperty("failedRequests") &&
3993
+ entity.hasOwnProperty("errors") &&
3994
+ entity.hasOwnProperty("cacheHits");
3928
3995
  }
3929
- }
3930
-
3931
- /*! @azure/msal-common v16.4.0 2026-03-18 */
3932
- /*
3933
- * Copyright (c) Microsoft Corporation. All rights reserved.
3934
- * Licensed under the MIT License.
3935
- */
3996
+ return validateKey && validateEntity;
3997
+ }
3936
3998
  /**
3937
- * Utility functions for managing date and time operations.
3999
+ * validates if a given cache entry is "Throttling", parses <key,value>
4000
+ * @param key
4001
+ * @param entity
3938
4002
  */
4003
+ function isThrottlingEntity(key, entity) {
4004
+ let validateKey = false;
4005
+ if (key) {
4006
+ validateKey = key.indexOf(THROTTLING_PREFIX) === 0;
4007
+ }
4008
+ let validateEntity = true;
4009
+ if (entity) {
4010
+ validateEntity = entity.hasOwnProperty("throttleTime");
4011
+ }
4012
+ return validateKey && validateEntity;
4013
+ }
3939
4014
  /**
3940
- * return the current time in Unix time (seconds).
4015
+ * Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
3941
4016
  */
3942
- function nowSeconds() {
3943
- // Date.getTime() returns in milliseconds.
3944
- return Math.round(new Date().getTime() / 1000.0);
4017
+ function generateAppMetadataKey({ environment, clientId, }) {
4018
+ const appMetaDataKeyArray = [
4019
+ APP_METADATA,
4020
+ environment,
4021
+ clientId,
4022
+ ];
4023
+ return appMetaDataKeyArray
4024
+ .join(CACHE_KEY_SEPARATOR)
4025
+ .toLowerCase();
3945
4026
  }
3946
- /**
3947
- * Convert seconds to JS Date object. Seconds can be in a number or string format or undefined (will still return a date).
3948
- * @param seconds
4027
+ /*
4028
+ * Validates an entity: checks for all expected params
4029
+ * @param entity
3949
4030
  */
3950
- function toDateFromSeconds(seconds) {
3951
- if (seconds) {
3952
- return new Date(Number(seconds) * 1000);
4031
+ function isAppMetadataEntity(key, entity) {
4032
+ if (!entity) {
4033
+ return false;
3953
4034
  }
3954
- return new Date();
4035
+ return (key.indexOf(APP_METADATA) === 0 &&
4036
+ entity.hasOwnProperty("clientId") &&
4037
+ entity.hasOwnProperty("environment"));
3955
4038
  }
3956
4039
  /**
3957
- * check if a token is expired based on given UTC time in seconds.
3958
- * @param expiresOn
4040
+ * Validates an entity: checks for all expected params
4041
+ * @param entity
3959
4042
  */
3960
- function isTokenExpired(expiresOn, offset) {
3961
- // check for access token expiry
3962
- const expirationSec = Number(expiresOn) || 0;
3963
- const offsetCurrentTimeSec = nowSeconds() + offset;
3964
- // If current time + offset is greater than token expiration time, then token is expired.
3965
- return offsetCurrentTimeSec > expirationSec;
4043
+ function isAuthorityMetadataEntity(key, entity) {
4044
+ if (!entity) {
4045
+ return false;
4046
+ }
4047
+ return (key.indexOf(AUTHORITY_METADATA_CACHE_KEY) === 0 &&
4048
+ entity.hasOwnProperty("aliases") &&
4049
+ entity.hasOwnProperty("preferred_cache") &&
4050
+ entity.hasOwnProperty("preferred_network") &&
4051
+ entity.hasOwnProperty("canonical_authority") &&
4052
+ entity.hasOwnProperty("authorization_endpoint") &&
4053
+ entity.hasOwnProperty("token_endpoint") &&
4054
+ entity.hasOwnProperty("issuer") &&
4055
+ entity.hasOwnProperty("aliasesFromNetwork") &&
4056
+ entity.hasOwnProperty("endpointsFromNetwork") &&
4057
+ entity.hasOwnProperty("expiresAt") &&
4058
+ entity.hasOwnProperty("jwks_uri"));
3966
4059
  }
3967
4060
  /**
3968
- * If the current time is earlier than the time that a token was cached at, we must discard the token
3969
- * i.e. The system clock was turned back after acquiring the cached token
3970
- * @param cachedAt
3971
- * @param offset
4061
+ * Reset the exiresAt value
3972
4062
  */
3973
- function wasClockTurnedBack(cachedAt) {
3974
- const cachedAtSec = Number(cachedAt);
3975
- return cachedAtSec > nowSeconds();
4063
+ function generateAuthorityMetadataExpiresAt() {
4064
+ return (nowSeconds() +
4065
+ AUTHORITY_METADATA_REFRESH_TIME_SECONDS);
4066
+ }
4067
+ function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
4068
+ authorityMetadata.authorization_endpoint =
4069
+ updatedValues.authorization_endpoint;
4070
+ authorityMetadata.token_endpoint = updatedValues.token_endpoint;
4071
+ authorityMetadata.end_session_endpoint = updatedValues.end_session_endpoint;
4072
+ authorityMetadata.issuer = updatedValues.issuer;
4073
+ authorityMetadata.endpointsFromNetwork = fromNetwork;
4074
+ authorityMetadata.jwks_uri = updatedValues.jwks_uri;
4075
+ }
4076
+ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {
4077
+ authorityMetadata.aliases = updatedValues.aliases;
4078
+ authorityMetadata.preferred_cache = updatedValues.preferred_cache;
4079
+ authorityMetadata.preferred_network = updatedValues.preferred_network;
4080
+ authorityMetadata.aliasesFromNetwork = fromNetwork;
3976
4081
  }
3977
4082
  /**
3978
- * Waits for t number of milliseconds
3979
- * @param t number
3980
- * @param value T
4083
+ * Returns whether or not the data needs to be refreshed
3981
4084
  */
3982
- function delay(t, value) {
3983
- return new Promise((resolve) => setTimeout(() => resolve(value), t));
4085
+ function isAuthorityMetadataExpired(metadata) {
4086
+ return metadata.expiresAt <= nowSeconds();
3984
4087
  }
3985
4088
 
3986
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4089
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
3987
4090
  /*
3988
4091
  * Copyright (c) Microsoft Corporation. All rights reserved.
3989
4092
  * Licensed under the MIT License.
@@ -4045,7 +4148,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
4045
4148
  */
4046
4149
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
4047
4150
 
4048
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4151
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4049
4152
  /*
4050
4153
  * Copyright (c) Microsoft Corporation. All rights reserved.
4051
4154
  * Licensed under the MIT License.
@@ -4138,7 +4241,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4138
4241
  };
4139
4242
  };
4140
4243
 
4141
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4244
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4142
4245
 
4143
4246
  /*
4144
4247
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4218,293 +4321,190 @@ class PopTokenGenerator {
4218
4321
  }
4219
4322
  }
4220
4323
 
4221
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4222
- /*
4223
- * Copyright (c) Microsoft Corporation. All rights reserved.
4224
- * Licensed under the MIT License.
4225
- */
4226
- /**
4227
- * This class instance helps track the memory changes facilitating
4228
- * decisions to read from and write to the persistent cache
4229
- */ class TokenCacheContext {
4230
- constructor(tokenCache, hasChanged) {
4231
- this.cache = tokenCache;
4232
- this.hasChanged = hasChanged;
4233
- }
4234
- /**
4235
- * boolean which indicates the changes in cache
4236
- */
4237
- get cacheHasChanged() {
4238
- return this.hasChanged;
4239
- }
4240
- /**
4241
- * function to retrieve the token cache
4242
- */
4243
- get tokenCache() {
4244
- return this.cache;
4245
- }
4246
- }
4247
-
4248
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4249
-
4324
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4250
4325
  /*
4251
4326
  * Copyright (c) Microsoft Corporation. All rights reserved.
4252
4327
  * Licensed under the MIT License.
4253
4328
  */
4254
4329
  /**
4255
- * Create IdTokenEntity
4256
- * @param homeAccountId
4257
- * @param authenticationResult
4258
- * @param clientId
4259
- * @param authority
4330
+ * MSAL-defined interaction required error code indicating no tokens are found in cache.
4331
+ * @public
4260
4332
  */
4261
- function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
4262
- const idTokenEntity = {
4263
- credentialType: CredentialType.ID_TOKEN,
4264
- homeAccountId: homeAccountId,
4265
- environment: environment,
4266
- clientId: clientId,
4267
- secret: idToken,
4268
- realm: tenantId,
4269
- lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
4270
- };
4271
- return idTokenEntity;
4272
- }
4333
+ const noTokensFound = "no_tokens_found";
4273
4334
  /**
4274
- * Create AccessTokenEntity
4275
- * @param homeAccountId
4276
- * @param environment
4277
- * @param accessToken
4278
- * @param clientId
4279
- * @param tenantId
4280
- * @param scopes
4281
- * @param expiresOn
4282
- * @param extExpiresOn
4335
+ * MSAL-defined error code indicating a native account is unavailable on the platform.
4336
+ * @public
4283
4337
  */
4284
- function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId) {
4285
- const atEntity = {
4286
- homeAccountId: homeAccountId,
4287
- credentialType: CredentialType.ACCESS_TOKEN,
4288
- secret: accessToken,
4289
- cachedAt: nowSeconds().toString(),
4290
- expiresOn: expiresOn.toString(),
4291
- extendedExpiresOn: extExpiresOn.toString(),
4292
- environment: environment,
4293
- clientId: clientId,
4294
- realm: tenantId,
4295
- target: scopes,
4296
- tokenType: tokenType || AuthenticationScheme.BEARER,
4297
- lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
4298
- };
4299
- if (userAssertionHash) {
4300
- atEntity.userAssertionHash = userAssertionHash;
4301
- }
4302
- if (refreshOn) {
4303
- atEntity.refreshOn = refreshOn.toString();
4304
- }
4305
- /*
4306
- * Create Access Token With Auth Scheme instead of regular access token
4307
- * Cast to lower to handle "bearer" from ADFS
4308
- */
4309
- if (atEntity.tokenType?.toLowerCase() !==
4310
- AuthenticationScheme.BEARER.toLowerCase()) {
4311
- atEntity.credentialType =
4312
- CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
4313
- switch (atEntity.tokenType) {
4314
- case AuthenticationScheme.POP:
4315
- // Make sure keyId is present and add it to credential
4316
- const tokenClaims = extractTokenClaims(accessToken, base64Decode);
4317
- if (!tokenClaims?.cnf?.kid) {
4318
- throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
4319
- }
4320
- atEntity.keyId = tokenClaims.cnf.kid;
4321
- break;
4322
- case AuthenticationScheme.SSH:
4323
- atEntity.keyId = keyId;
4324
- }
4325
- }
4326
- return atEntity;
4327
- }
4338
+ const nativeAccountUnavailable = "native_account_unavailable";
4328
4339
  /**
4329
- * Create RefreshTokenEntity
4330
- * @param homeAccountId
4331
- * @param authenticationResult
4332
- * @param clientId
4333
- * @param authority
4340
+ * MSAL-defined error code indicating the refresh token has expired and user interaction is needed.
4341
+ * @public
4334
4342
  */
4335
- function createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {
4336
- const rtEntity = {
4337
- credentialType: CredentialType.REFRESH_TOKEN,
4338
- homeAccountId: homeAccountId,
4339
- environment: environment,
4340
- clientId: clientId,
4341
- secret: refreshToken,
4342
- lastUpdatedAt: Date.now().toString(),
4343
- };
4344
- if (userAssertionHash) {
4345
- rtEntity.userAssertionHash = userAssertionHash;
4346
- }
4347
- if (familyId) {
4348
- rtEntity.familyId = familyId;
4349
- }
4350
- if (expiresOn) {
4351
- rtEntity.expiresOn = expiresOn.toString();
4352
- }
4353
- return rtEntity;
4354
- }
4355
- function isCredentialEntity(entity) {
4356
- return (entity.hasOwnProperty("homeAccountId") &&
4357
- entity.hasOwnProperty("environment") &&
4358
- entity.hasOwnProperty("credentialType") &&
4359
- entity.hasOwnProperty("clientId") &&
4360
- entity.hasOwnProperty("secret"));
4361
- }
4343
+ const refreshTokenExpired = "refresh_token_expired";
4362
4344
  /**
4363
- * Validates an entity: checks for all expected params
4364
- * @param entity
4345
+ * MSAL-defined error code indicating UI/UX is not allowed (e.g., blocked by policy), requiring alternate interaction.
4346
+ * @public
4365
4347
  */
4366
- function isAccessTokenEntity(entity) {
4367
- if (!entity) {
4368
- return false;
4369
- }
4370
- return (isCredentialEntity(entity) &&
4371
- entity.hasOwnProperty("realm") &&
4372
- entity.hasOwnProperty("target") &&
4373
- (entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
4374
- entity["credentialType"] ===
4375
- CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
4376
- }
4348
+ const uxNotAllowed = "ux_not_allowed";
4377
4349
  /**
4378
- * Validates an entity: checks for all expected params
4379
- * @param entity
4350
+ * Server-originated error code indicating interaction is required to complete the request.
4351
+ * @public
4380
4352
  */
4381
- function isIdTokenEntity(entity) {
4382
- if (!entity) {
4383
- return false;
4384
- }
4385
- return (isCredentialEntity(entity) &&
4386
- entity.hasOwnProperty("realm") &&
4387
- entity["credentialType"] === CredentialType.ID_TOKEN);
4388
- }
4353
+ const interactionRequired = "interaction_required";
4389
4354
  /**
4390
- * Validates an entity: checks for all expected params
4391
- * @param entity
4355
+ * Server-originated error code indicating user consent is required.
4356
+ * @public
4392
4357
  */
4393
- function isRefreshTokenEntity(entity) {
4394
- if (!entity) {
4395
- return false;
4396
- }
4397
- return (isCredentialEntity(entity) &&
4398
- entity["credentialType"] === CredentialType.REFRESH_TOKEN);
4399
- }
4358
+ const consentRequired = "consent_required";
4400
4359
  /**
4401
- * validates if a given cache entry is "Telemetry", parses <key,value>
4402
- * @param key
4403
- * @param entity
4360
+ * Server-originated error code indicating user login is required.
4361
+ * @public
4404
4362
  */
4405
- function isServerTelemetryEntity(key, entity) {
4406
- const validateKey = key.indexOf(SERVER_TELEM_CACHE_KEY) === 0;
4407
- let validateEntity = true;
4408
- if (entity) {
4409
- validateEntity =
4410
- entity.hasOwnProperty("failedRequests") &&
4411
- entity.hasOwnProperty("errors") &&
4412
- entity.hasOwnProperty("cacheHits");
4413
- }
4414
- return validateKey && validateEntity;
4415
- }
4363
+ const loginRequired = "login_required";
4416
4364
  /**
4417
- * validates if a given cache entry is "Throttling", parses <key,value>
4418
- * @param key
4419
- * @param entity
4365
+ * Server-originated error code indicating the token is invalid or corrupted.
4366
+ * @public
4420
4367
  */
4421
- function isThrottlingEntity(key, entity) {
4422
- let validateKey = false;
4423
- if (key) {
4424
- validateKey = key.indexOf(THROTTLING_PREFIX) === 0;
4425
- }
4426
- let validateEntity = true;
4427
- if (entity) {
4428
- validateEntity = entity.hasOwnProperty("throttleTime");
4429
- }
4430
- return validateKey && validateEntity;
4431
- }
4368
+ const badToken = "bad_token";
4432
4369
  /**
4433
- * Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
4370
+ * Server-originated error code indicating the user is in an interrupted state and interaction is required.
4371
+ * @public
4434
4372
  */
4435
- function generateAppMetadataKey({ environment, clientId, }) {
4436
- const appMetaDataKeyArray = [
4437
- APP_METADATA,
4438
- environment,
4439
- clientId,
4440
- ];
4441
- return appMetaDataKeyArray
4442
- .join(CACHE_KEY_SEPARATOR)
4443
- .toLowerCase();
4444
- }
4373
+ const interruptedUser = "interrupted_user";
4374
+
4375
+ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
4376
+ __proto__: null,
4377
+ badToken: badToken,
4378
+ consentRequired: consentRequired,
4379
+ interactionRequired: interactionRequired,
4380
+ interruptedUser: interruptedUser,
4381
+ loginRequired: loginRequired,
4382
+ nativeAccountUnavailable: nativeAccountUnavailable,
4383
+ noTokensFound: noTokensFound,
4384
+ refreshTokenExpired: refreshTokenExpired,
4385
+ uxNotAllowed: uxNotAllowed
4386
+ });
4387
+
4388
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4389
+
4445
4390
  /*
4446
- * Validates an entity: checks for all expected params
4447
- * @param entity
4391
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4392
+ * Licensed under the MIT License.
4448
4393
  */
4449
- function isAppMetadataEntity(key, entity) {
4450
- if (!entity) {
4451
- return false;
4452
- }
4453
- return (key.indexOf(APP_METADATA) === 0 &&
4454
- entity.hasOwnProperty("clientId") &&
4455
- entity.hasOwnProperty("environment"));
4456
- }
4457
4394
  /**
4458
- * Validates an entity: checks for all expected params
4459
- * @param entity
4395
+ * InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required
4460
4396
  */
4461
- function isAuthorityMetadataEntity(key, entity) {
4462
- if (!entity) {
4463
- return false;
4397
+ const InteractionRequiredServerErrorMessage = [
4398
+ interactionRequired,
4399
+ consentRequired,
4400
+ loginRequired,
4401
+ badToken,
4402
+ uxNotAllowed,
4403
+ interruptedUser,
4404
+ ];
4405
+ const InteractionRequiredAuthSubErrorMessage = [
4406
+ "message_only",
4407
+ "additional_action",
4408
+ "basic_action",
4409
+ "user_password_expired",
4410
+ "consent_required",
4411
+ "bad_token",
4412
+ "ux_not_allowed",
4413
+ "interrupted_user",
4414
+ ];
4415
+ /**
4416
+ * Error thrown when user interaction is required.
4417
+ */
4418
+ class InteractionRequiredAuthError extends AuthError {
4419
+ constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
4420
+ super(errorCode, errorMessage, subError);
4421
+ Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
4422
+ this.timestamp = timestamp || "";
4423
+ this.traceId = traceId || "";
4424
+ this.correlationId = correlationId || "";
4425
+ this.claims = claims || "";
4426
+ this.name = "InteractionRequiredAuthError";
4427
+ this.errorNo = errorNo;
4464
4428
  }
4465
- return (key.indexOf(AUTHORITY_METADATA_CACHE_KEY) === 0 &&
4466
- entity.hasOwnProperty("aliases") &&
4467
- entity.hasOwnProperty("preferred_cache") &&
4468
- entity.hasOwnProperty("preferred_network") &&
4469
- entity.hasOwnProperty("canonical_authority") &&
4470
- entity.hasOwnProperty("authorization_endpoint") &&
4471
- entity.hasOwnProperty("token_endpoint") &&
4472
- entity.hasOwnProperty("issuer") &&
4473
- entity.hasOwnProperty("aliasesFromNetwork") &&
4474
- entity.hasOwnProperty("endpointsFromNetwork") &&
4475
- entity.hasOwnProperty("expiresAt") &&
4476
- entity.hasOwnProperty("jwks_uri"));
4477
4429
  }
4478
4430
  /**
4479
- * Reset the exiresAt value
4431
+ * Helper function used to determine if an error thrown by the server requires interaction to resolve
4432
+ * @param errorCode
4433
+ * @param errorString
4434
+ * @param subError
4480
4435
  */
4481
- function generateAuthorityMetadataExpiresAt() {
4482
- return (nowSeconds() +
4483
- AUTHORITY_METADATA_REFRESH_TIME_SECONDS);
4484
- }
4485
- function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
4486
- authorityMetadata.authorization_endpoint =
4487
- updatedValues.authorization_endpoint;
4488
- authorityMetadata.token_endpoint = updatedValues.token_endpoint;
4489
- authorityMetadata.end_session_endpoint = updatedValues.end_session_endpoint;
4490
- authorityMetadata.issuer = updatedValues.issuer;
4491
- authorityMetadata.endpointsFromNetwork = fromNetwork;
4492
- authorityMetadata.jwks_uri = updatedValues.jwks_uri;
4493
- }
4494
- function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {
4495
- authorityMetadata.aliases = updatedValues.aliases;
4496
- authorityMetadata.preferred_cache = updatedValues.preferred_cache;
4497
- authorityMetadata.preferred_network = updatedValues.preferred_network;
4498
- authorityMetadata.aliasesFromNetwork = fromNetwork;
4436
+ function isInteractionRequiredError(errorCode, errorString, subError) {
4437
+ const isInteractionRequiredErrorCode = !!errorCode &&
4438
+ InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;
4439
+ const isInteractionRequiredSubError = !!subError &&
4440
+ InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;
4441
+ const isInteractionRequiredErrorDesc = !!errorString &&
4442
+ InteractionRequiredServerErrorMessage.some((irErrorCode) => {
4443
+ return errorString.indexOf(irErrorCode) > -1;
4444
+ });
4445
+ return (isInteractionRequiredErrorCode ||
4446
+ isInteractionRequiredErrorDesc ||
4447
+ isInteractionRequiredSubError);
4499
4448
  }
4500
4449
  /**
4501
- * Returns whether or not the data needs to be refreshed
4450
+ * Creates an InteractionRequiredAuthError
4502
4451
  */
4503
- function isAuthorityMetadataExpired(metadata) {
4504
- return metadata.expiresAt <= nowSeconds();
4452
+ function createInteractionRequiredAuthError(errorCode, errorMessage) {
4453
+ return new InteractionRequiredAuthError(errorCode, errorMessage);
4454
+ }
4455
+
4456
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4457
+
4458
+ /*
4459
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4460
+ * Licensed under the MIT License.
4461
+ */
4462
+ /**
4463
+ * Error thrown when there is an error with the server code, for example, unavailability.
4464
+ */
4465
+ class ServerError extends AuthError {
4466
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
4467
+ super(errorCode, errorMessage, subError);
4468
+ this.name = "ServerError";
4469
+ this.errorNo = errorNo;
4470
+ this.status = status;
4471
+ Object.setPrototypeOf(this, ServerError.prototype);
4472
+ }
4473
+ }
4474
+
4475
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4476
+ /**
4477
+ * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
4478
+ * @param base64Decode
4479
+ * @param state
4480
+ */
4481
+ function parseRequestState(base64Decode, state) {
4482
+ if (!base64Decode) {
4483
+ throw createClientAuthError(noCryptoObject);
4484
+ }
4485
+ if (!state) {
4486
+ throw createClientAuthError(invalidState);
4487
+ }
4488
+ try {
4489
+ // Split the state between library state and user passed state and decode them separately
4490
+ const splitState = state.split(RESOURCE_DELIM);
4491
+ const libraryState = splitState[0];
4492
+ const userState = splitState.length > 1
4493
+ ? splitState.slice(1).join(RESOURCE_DELIM)
4494
+ : "";
4495
+ const libraryStateString = base64Decode(libraryState);
4496
+ const libraryStateObj = JSON.parse(libraryStateString);
4497
+ return {
4498
+ userRequestState: userState || "",
4499
+ libraryState: libraryStateObj,
4500
+ };
4501
+ }
4502
+ catch (e) {
4503
+ throw createClientAuthError(invalidState);
4504
+ }
4505
4505
  }
4506
4506
 
4507
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4507
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4508
4508
 
4509
4509
  /*
4510
4510
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4660,7 +4660,7 @@ class ResponseHandler {
4660
4660
  if (serverTokenResponse.id_token && !!idTokenClaims) {
4661
4661
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
4662
4662
  cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, request.correlationId, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
4663
- this.logger);
4663
+ this.logger, this.performanceClient);
4664
4664
  }
4665
4665
  // AccessToken
4666
4666
  let cachedAccessToken = null;
@@ -4811,17 +4811,24 @@ class ResponseHandler {
4811
4811
  };
4812
4812
  }
4813
4813
  }
4814
- function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
4814
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger, performanceClient) {
4815
4815
  logger?.verbose("setCachedAccount called", correlationId);
4816
- // Check if base account is already cached
4817
- const accountKeys = cacheStorage.getAccountKeys();
4818
- const baseAccountKey = accountKeys.find((accountKey) => {
4819
- return accountKey.startsWith(homeAccountId);
4820
- });
4821
- let cachedAccount = null;
4822
- if (baseAccountKey) {
4823
- cachedAccount = cacheStorage.getAccount(baseAccountKey, correlationId);
4816
+ /*
4817
+ * Check if base account is already cached. Filter by homeAccountId (identifies
4818
+ * the user's home identity) and environment (identifies the cloud) — the two
4819
+ * tenant-agnostic properties that uniquely locate a base AccountEntity.
4820
+ */
4821
+ const accountEnvironment = environment || authority.getPreferredCache();
4822
+ const matchedAccounts = cacheStorage.getAccountsFilteredBy({ homeAccountId, environment: accountEnvironment }, correlationId);
4823
+ performanceClient?.addFields({ cacheMatchedAccounts: matchedAccounts.length }, correlationId);
4824
+ if (matchedAccounts.length > 1) {
4825
+ /*
4826
+ * Base accounts are expected to be unique for a given homeAccountId in normal cache usage.
4827
+ * If multiple matches exist, ignore the cache hit rather than arbitrarily choosing one.
4828
+ */
4829
+ logger?.warning("Multiple base accounts matched homeAccountId. Ignoring cached account and creating a new base account.", correlationId);
4824
4830
  }
4831
+ const cachedAccount = matchedAccounts.length === 1 ? matchedAccounts[0] : null;
4825
4832
  const baseAccount = cachedAccount ||
4826
4833
  createAccountEntity({
4827
4834
  homeAccountId,
@@ -4845,7 +4852,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
4845
4852
  return baseAccount;
4846
4853
  }
4847
4854
 
4848
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4855
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4849
4856
  /*
4850
4857
  * Copyright (c) Microsoft Corporation. All rights reserved.
4851
4858
  * Licensed under the MIT License.
@@ -4855,7 +4862,7 @@ const CcsCredentialType = {
4855
4862
  UPN: "UPN",
4856
4863
  };
4857
4864
 
4858
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4865
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4859
4866
  /*
4860
4867
  * Copyright (c) Microsoft Corporation. All rights reserved.
4861
4868
  * Licensed under the MIT License.
@@ -4873,7 +4880,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
4873
4880
  }
4874
4881
  }
4875
4882
 
4876
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4883
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4877
4884
  /*
4878
4885
  * Copyright (c) Microsoft Corporation. All rights reserved.
4879
4886
  * Licensed under the MIT License.
@@ -4894,7 +4901,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
4894
4901
  };
4895
4902
  }
4896
4903
 
4897
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4904
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4898
4905
 
4899
4906
  /*
4900
4907
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4980,7 +4987,7 @@ class ThrottlingUtils {
4980
4987
  }
4981
4988
  }
4982
4989
 
4983
- /*! @azure/msal-common v16.4.0 2026-03-18 */
4990
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
4984
4991
 
4985
4992
  /*
4986
4993
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5011,7 +5018,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
5011
5018
  return new NetworkError(error, httpStatus, responseHeaders);
5012
5019
  }
5013
5020
 
5014
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5021
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5015
5022
 
5016
5023
  /*
5017
5024
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5125,7 +5132,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
5125
5132
  return response;
5126
5133
  }
5127
5134
 
5128
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5135
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5129
5136
  /*
5130
5137
  * Copyright (c) Microsoft Corporation. All rights reserved.
5131
5138
  * Licensed under the MIT License.
@@ -5137,7 +5144,7 @@ function isOpenIdConfigResponse(response) {
5137
5144
  response.hasOwnProperty("jwks_uri"));
5138
5145
  }
5139
5146
 
5140
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5147
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5141
5148
  /*
5142
5149
  * Copyright (c) Microsoft Corporation. All rights reserved.
5143
5150
  * Licensed under the MIT License.
@@ -5147,7 +5154,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5147
5154
  response.hasOwnProperty("metadata"));
5148
5155
  }
5149
5156
 
5150
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5157
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5151
5158
  /*
5152
5159
  * Copyright (c) Microsoft Corporation. All rights reserved.
5153
5160
  * Licensed under the MIT License.
@@ -5157,7 +5164,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
5157
5164
  response.hasOwnProperty("error_description"));
5158
5165
  }
5159
5166
 
5160
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5167
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5161
5168
 
5162
5169
  /*
5163
5170
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5262,7 +5269,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5262
5269
  },
5263
5270
  };
5264
5271
 
5265
- /*! @azure/msal-common v16.4.0 2026-03-18 */
5272
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
5266
5273
 
5267
5274
  /*
5268
5275
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6085,7 +6092,7 @@ function buildStaticAuthorityOptions(authOptions) {
6085
6092
  };
6086
6093
  }
6087
6094
 
6088
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6095
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6089
6096
 
6090
6097
  /*
6091
6098
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6119,7 +6126,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6119
6126
  }
6120
6127
  }
6121
6128
 
6122
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6129
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6123
6130
 
6124
6131
  /*
6125
6132
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6380,7 +6387,7 @@ class AuthorizationCodeClient {
6380
6387
  }
6381
6388
  }
6382
6389
 
6383
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6390
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6384
6391
 
6385
6392
  /*
6386
6393
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6605,7 +6612,7 @@ class RefreshTokenClient {
6605
6612
  }
6606
6613
  }
6607
6614
 
6608
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6615
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6609
6616
 
6610
6617
  /*
6611
6618
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6721,7 +6728,7 @@ class SilentFlowClient {
6721
6728
  }
6722
6729
  }
6723
6730
 
6724
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6731
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6725
6732
 
6726
6733
  /*
6727
6734
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6874,7 +6881,7 @@ function extractLoginHint(account) {
6874
6881
  return account.loginHint || account.idTokenClaims?.login_hint || null;
6875
6882
  }
6876
6883
 
6877
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6884
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6878
6885
 
6879
6886
  /*
6880
6887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6907,7 +6914,7 @@ function containsResourceParam(params) {
6907
6914
  return Object.prototype.hasOwnProperty.call(params, "resource");
6908
6915
  }
6909
6916
 
6910
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6917
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6911
6918
  /*
6912
6919
  * Copyright (c) Microsoft Corporation. All rights reserved.
6913
6920
  * Licensed under the MIT License.
@@ -6924,7 +6931,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
6924
6931
  unexpectedError: unexpectedError
6925
6932
  });
6926
6933
 
6927
- /*! @azure/msal-common v16.4.0 2026-03-18 */
6934
+ /*! @azure/msal-common v16.4.1 2026-04-01 */
6928
6935
 
6929
6936
  /*
6930
6937
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9127,7 +9134,7 @@ class ClientAssertion {
9127
9134
 
9128
9135
  /* eslint-disable header/header */
9129
9136
  const name = "@azure/msal-node";
9130
- const version = "5.1.1";
9137
+ const version = "5.1.2";
9131
9138
 
9132
9139
  /*
9133
9140
  * Copyright (c) Microsoft Corporation. All rights reserved.