@azure/msal-node 5.2.4 → 5.3.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 (150) hide show
  1. package/dist/cache/CacheHelpers.mjs +16 -1
  2. package/dist/cache/CacheHelpers.mjs.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +1 -1
  4. package/dist/cache/TokenCache.mjs +1 -1
  5. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  6. package/dist/cache/serializer/Deserializer.mjs +2 -1
  7. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  8. package/dist/cache/serializer/Serializer.mjs +2 -1
  9. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  10. package/dist/client/BaseClient.mjs +1 -1
  11. package/dist/client/ClientApplication.mjs +9 -9
  12. package/dist/client/ClientApplication.mjs.map +1 -1
  13. package/dist/client/ClientAssertion.mjs +2 -2
  14. package/dist/client/ClientAssertion.mjs.map +1 -1
  15. package/dist/client/ClientCredentialClient.mjs +34 -16
  16. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  17. package/dist/client/ConfidentialClientApplication.mjs +61 -8
  18. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  19. package/dist/client/DeviceCodeClient.mjs +17 -16
  20. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  21. package/dist/client/ManagedIdentityApplication.mjs +2 -2
  22. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  23. package/dist/client/ManagedIdentityClient.mjs +2 -2
  24. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  25. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  26. package/dist/client/ManagedIdentitySources/AzureArc.mjs +11 -11
  27. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  28. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +6 -5
  29. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  30. package/dist/client/ManagedIdentitySources/CloudShell.mjs +2 -2
  31. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  32. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  33. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  34. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  35. package/dist/client/OnBehalfOfClient.mjs +9 -9
  36. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  37. package/dist/client/PublicClientApplication.mjs +10 -9
  38. package/dist/client/PublicClientApplication.mjs.map +1 -1
  39. package/dist/client/UserFederatedIdentityCredentialClient.mjs +107 -0
  40. package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -0
  41. package/dist/client/UsernamePasswordClient.mjs +3 -3
  42. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  43. package/dist/config/Configuration.mjs +1 -1
  44. package/dist/config/ManagedIdentityId.mjs +4 -4
  45. package/dist/config/ManagedIdentityId.mjs.map +1 -1
  46. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  47. package/dist/crypto/CryptoProvider.mjs +1 -1
  48. package/dist/crypto/GuidGenerator.mjs +1 -1
  49. package/dist/crypto/HashUtils.mjs +1 -1
  50. package/dist/crypto/PkceGenerator.mjs +1 -1
  51. package/dist/error/ClientAuthErrorCodes.mjs +5 -2
  52. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  53. package/dist/error/ManagedIdentityError.mjs +5 -5
  54. package/dist/error/ManagedIdentityError.mjs.map +1 -1
  55. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  56. package/dist/error/NodeAuthError.mjs +16 -16
  57. package/dist/error/NodeAuthError.mjs.map +1 -1
  58. package/dist/index.mjs +1 -1
  59. package/dist/index.mjs.map +1 -1
  60. package/dist/internals.mjs +1 -1
  61. package/dist/network/HttpClient.mjs +4 -4
  62. package/dist/network/HttpClient.mjs.map +1 -1
  63. package/dist/network/HttpClientWithRetries.mjs +1 -1
  64. package/dist/network/LoopbackClient.mjs +1 -1
  65. package/dist/packageMetadata.mjs +2 -2
  66. package/dist/protocol/Authorize.mjs +1 -1
  67. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  68. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  69. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  70. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  71. package/dist/utils/Constants.mjs +2 -1
  72. package/dist/utils/Constants.mjs.map +1 -1
  73. package/dist/utils/EncodingUtils.mjs +1 -1
  74. package/dist/utils/TimeUtils.mjs +1 -1
  75. package/lib/msal-node.cjs +778 -521
  76. package/lib/msal-node.cjs.map +1 -1
  77. package/package.json +4 -4
  78. package/src/cache/CacheHelpers.ts +25 -0
  79. package/src/cache/serializer/Deserializer.ts +2 -0
  80. package/src/cache/serializer/Serializer.ts +2 -0
  81. package/src/cache/serializer/SerializerTypes.ts +1 -0
  82. package/src/client/ClientApplication.ts +19 -8
  83. package/src/client/ClientAssertion.ts +4 -1
  84. package/src/client/ClientCredentialClient.ts +61 -14
  85. package/src/client/ConfidentialClientApplication.ts +108 -6
  86. package/src/client/DeviceCodeClient.ts +28 -10
  87. package/src/client/ManagedIdentityApplication.ts +2 -1
  88. package/src/client/ManagedIdentityClient.ts +2 -1
  89. package/src/client/ManagedIdentitySources/AzureArc.ts +20 -10
  90. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +10 -4
  91. package/src/client/ManagedIdentitySources/CloudShell.ts +2 -1
  92. package/src/client/OnBehalfOfClient.ts +22 -7
  93. package/src/client/PublicClientApplication.ts +23 -7
  94. package/src/client/UserFederatedIdentityCredentialClient.ts +226 -0
  95. package/src/client/UsernamePasswordClient.ts +6 -1
  96. package/src/config/ManagedIdentityId.ts +6 -3
  97. package/src/error/ClientAuthErrorCodes.ts +3 -0
  98. package/src/error/ManagedIdentityError.ts +9 -4
  99. package/src/error/NodeAuthError.ts +25 -6
  100. package/src/index.ts +1 -0
  101. package/src/network/HttpClient.ts +3 -0
  102. package/src/packageMetadata.ts +1 -1
  103. package/src/request/CommonClientCredentialRequest.ts +4 -0
  104. package/src/request/CommonUserFederatedIdentityCredentialRequest.ts +25 -0
  105. package/src/request/UserFederatedIdentityCredentialRequest.ts +46 -0
  106. package/src/utils/Constants.ts +1 -0
  107. package/types/cache/CacheHelpers.d.ts.map +1 -1
  108. package/types/cache/serializer/Deserializer.d.ts.map +1 -1
  109. package/types/cache/serializer/Serializer.d.ts.map +1 -1
  110. package/types/cache/serializer/SerializerTypes.d.ts +1 -0
  111. package/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  112. package/types/client/ClientApplication.d.ts +1 -1
  113. package/types/client/ClientApplication.d.ts.map +1 -1
  114. package/types/client/ClientAssertion.d.ts.map +1 -1
  115. package/types/client/ClientCredentialClient.d.ts +1 -1
  116. package/types/client/ClientCredentialClient.d.ts.map +1 -1
  117. package/types/client/ConfidentialClientApplication.d.ts +10 -0
  118. package/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  119. package/types/client/DeviceCodeClient.d.ts +1 -0
  120. package/types/client/DeviceCodeClient.d.ts.map +1 -1
  121. package/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  122. package/types/client/ManagedIdentityClient.d.ts.map +1 -1
  123. package/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  124. package/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  125. package/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  126. package/types/client/OnBehalfOfClient.d.ts.map +1 -1
  127. package/types/client/PublicClientApplication.d.ts +1 -0
  128. package/types/client/PublicClientApplication.d.ts.map +1 -1
  129. package/types/client/UserFederatedIdentityCredentialClient.d.ts +26 -0
  130. package/types/client/UserFederatedIdentityCredentialClient.d.ts.map +1 -0
  131. package/types/client/UsernamePasswordClient.d.ts.map +1 -1
  132. package/types/config/ManagedIdentityId.d.ts.map +1 -1
  133. package/types/error/ClientAuthErrorCodes.d.ts +3 -0
  134. package/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
  135. package/types/error/ManagedIdentityError.d.ts +2 -2
  136. package/types/error/ManagedIdentityError.d.ts.map +1 -1
  137. package/types/error/NodeAuthError.d.ts +5 -5
  138. package/types/error/NodeAuthError.d.ts.map +1 -1
  139. package/types/index.d.ts +1 -0
  140. package/types/index.d.ts.map +1 -1
  141. package/types/network/HttpClient.d.ts.map +1 -1
  142. package/types/packageMetadata.d.ts +1 -1
  143. package/types/request/CommonClientCredentialRequest.d.ts +4 -0
  144. package/types/request/CommonClientCredentialRequest.d.ts.map +1 -1
  145. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts +17 -0
  146. package/types/request/CommonUserFederatedIdentityCredentialRequest.d.ts.map +1 -0
  147. package/types/request/UserFederatedIdentityCredentialRequest.d.ts +32 -0
  148. package/types/request/UserFederatedIdentityCredentialRequest.d.ts.map +1 -0
  149. package/types/utils/Constants.d.ts +1 -0
  150. package/types/utils/Constants.d.ts.map +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v5.2.4 2026-06-10 */
1
+ /*! @azure/msal-node v5.3.0 2026-06-23 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -94,6 +94,7 @@ class Serializer {
94
94
  token_type: atEntity.tokenType,
95
95
  userAssertionHash: atEntity.userAssertionHash,
96
96
  resource: atEntity.resource,
97
+ additionalCacheKeyComponents: atEntity.additionalCacheKeyComponents,
97
98
  };
98
99
  });
99
100
  return accessTokens;
@@ -150,7 +151,7 @@ class Serializer {
150
151
  }
151
152
  }
152
153
 
153
- /*! @azure/msal-common v16.8.0 2026-06-10 */
154
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
154
155
  /*
155
156
  * Copyright (c) Microsoft Corporation. All rights reserved.
156
157
  * Licensed under the MIT License.
@@ -180,8 +181,8 @@ const AUTHORIZATION_PENDING = "authorization_pending";
180
181
  const NOT_APPLICABLE = "N/A";
181
182
  const NOT_AVAILABLE = "Not Available";
182
183
  const FORWARD_SLASH = "/";
183
- const IMDS_ENDPOINT = "http://169.254.169.254/metadata/instance/compute/location";
184
- const IMDS_VERSION = "2020-06-01";
184
+ const IMDS_ENDPOINT = "http://169.254.169.254/metadata/instance/compute";
185
+ const IMDS_VERSION = "2021-02-01";
185
186
  const IMDS_TIMEOUT = 2000;
186
187
  const AZURE_REGION_AUTO_DISCOVER_FLAG = "TryAutoDetect";
187
188
  const REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX = "login.microsoft.com";
@@ -240,6 +241,9 @@ const AADAuthority = {
240
241
  const ClaimsRequestKeys = {
241
242
  ACCESS_TOKEN: "access_token",
242
243
  XMS_CC: "xms_cc",
244
+ ID_TOKEN: "id_token",
245
+ SIGNIN_STATE: "signin_state",
246
+ LOGIN_HINT: "login_hint",
243
247
  };
244
248
  /**
245
249
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
@@ -284,6 +288,7 @@ const GrantType = {
284
288
  REFRESH_TOKEN_GRANT: "refresh_token",
285
289
  DEVICE_CODE_GRANT: "device_code",
286
290
  JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer",
291
+ USER_FIC: "user_fic",
287
292
  };
288
293
  /**
289
294
  * Account types in Cache
@@ -398,7 +403,7 @@ const EncodingTypes = {
398
403
  UTF8: "utf-8",
399
404
  };
400
405
 
401
- /*! @azure/msal-common v16.8.0 2026-06-10 */
406
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
402
407
  /*
403
408
  * Copyright (c) Microsoft Corporation. All rights reserved.
404
409
  * Licensed under the MIT License.
@@ -449,9 +454,13 @@ const BROKER_CLIENT_ID = "brk_client_id";
449
454
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
450
455
  const INSTANCE_AWARE = "instance_aware";
451
456
  const RESOURCE = "resource";
452
- const CLI_DATA = "clidata";
457
+ const CLI_DATA = "clidata";
458
+ const USER_FEDERATED_IDENTITY_CREDENTIAL = "user_federated_identity_credential";
459
+ const USERNAME = "username";
460
+ const USER_ID = "user_id";
461
+ const FMI_PATH = "fmi_path";
453
462
 
454
- /*! @azure/msal-common v16.8.0 2026-06-10 */
463
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
455
464
  /*
456
465
  * Copyright (c) Microsoft Corporation. All rights reserved.
457
466
  * Licensed under the MIT License.
@@ -463,7 +472,7 @@ function getDefaultErrorMessage(code) {
463
472
  * General error class thrown by the MSAL.js library.
464
473
  */
465
474
  class AuthError extends Error {
466
- constructor(errorCode, errorMessage, suberror) {
475
+ constructor(errorCode, correlationId, errorMessage, suberror) {
467
476
  const message = errorMessage ||
468
477
  (errorCode ? getDefaultErrorMessage(errorCode) : "");
469
478
  const errorString = message ? `${errorCode}: ${message}` : errorCode;
@@ -472,17 +481,15 @@ class AuthError extends Error {
472
481
  this.errorCode = errorCode || "";
473
482
  this.errorMessage = message || "";
474
483
  this.subError = suberror || "";
475
- this.name = "AuthError";
476
- }
477
- setCorrelationId(correlationId) {
478
484
  this.correlationId = correlationId;
485
+ this.name = "AuthError";
479
486
  }
480
487
  }
481
- function createAuthError(code, additionalMessage) {
482
- return new AuthError(code, additionalMessage || getDefaultErrorMessage(code));
488
+ function createAuthError(code, correlationId, additionalMessage) {
489
+ return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
483
490
  }
484
491
 
485
- /*! @azure/msal-common v16.8.0 2026-06-10 */
492
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
486
493
 
487
494
  /*
488
495
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -492,17 +499,17 @@ function createAuthError(code, additionalMessage) {
492
499
  * Error thrown when there is an error in configuration of the MSAL.js library.
493
500
  */
494
501
  class ClientConfigurationError extends AuthError {
495
- constructor(errorCode) {
496
- super(errorCode);
502
+ constructor(errorCode, correlationId) {
503
+ super(errorCode, correlationId);
497
504
  this.name = "ClientConfigurationError";
498
505
  Object.setPrototypeOf(this, ClientConfigurationError.prototype);
499
506
  }
500
507
  }
501
- function createClientConfigurationError(errorCode) {
502
- return new ClientConfigurationError(errorCode);
508
+ function createClientConfigurationError(errorCode, correlationId) {
509
+ return new ClientConfigurationError(errorCode, correlationId);
503
510
  }
504
511
 
505
- /*! @azure/msal-common v16.8.0 2026-06-10 */
512
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
506
513
  /*
507
514
  * Copyright (c) Microsoft Corporation. All rights reserved.
508
515
  * Licensed under the MIT License.
@@ -582,7 +589,7 @@ class StringUtils {
582
589
  }
583
590
  }
584
591
 
585
- /*! @azure/msal-common v16.8.0 2026-06-10 */
592
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
586
593
 
587
594
  /*
588
595
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -595,17 +602,17 @@ class StringUtils {
595
602
  * Error thrown when there is an error in the client code running on the browser.
596
603
  */
597
604
  class ClientAuthError extends AuthError {
598
- constructor(errorCode, additionalMessage) {
599
- super(errorCode, additionalMessage);
605
+ constructor(errorCode, correlationId, additionalMessage) {
606
+ super(errorCode, correlationId, additionalMessage);
600
607
  this.name = "ClientAuthError";
601
608
  Object.setPrototypeOf(this, ClientAuthError.prototype);
602
609
  }
603
610
  }
604
- function createClientAuthError(errorCode, additionalMessage) {
605
- return new ClientAuthError(errorCode, additionalMessage);
611
+ function createClientAuthError(errorCode, correlationId, additionalMessage) {
612
+ return new ClientAuthError(errorCode, correlationId, additionalMessage);
606
613
  }
607
614
 
608
- /*! @azure/msal-common v16.8.0 2026-06-10 */
615
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
609
616
  /*
610
617
  * Copyright (c) Microsoft Corporation. All rights reserved.
611
618
  * Licensed under the MIT License.
@@ -663,7 +670,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
663
670
  urlParseError: urlParseError
664
671
  });
665
672
 
666
- /*! @azure/msal-common v16.8.0 2026-06-10 */
673
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
667
674
  /*
668
675
  * Copyright (c) Microsoft Corporation. All rights reserved.
669
676
  * Licensed under the MIT License.
@@ -680,8 +687,6 @@ const invalidState = "invalid_state";
680
687
  const stateMismatch = "state_mismatch";
681
688
  const stateNotFound = "state_not_found";
682
689
  const nonceMismatch = "nonce_mismatch";
683
- const authTimeNotFound = "auth_time_not_found";
684
- const maxAgeTranspired = "max_age_transpired";
685
690
  const multipleMatchingTokens = "multiple_matching_tokens";
686
691
  const multipleMatchingAppMetadata = "multiple_matching_appMetadata";
687
692
  const requestCannotBeMade = "request_cannot_be_made";
@@ -710,7 +715,6 @@ const misplacedResourceParam = "misplaced_resource_parameter";
710
715
 
711
716
  var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
712
717
  __proto__: null,
713
- authTimeNotFound: authTimeNotFound,
714
718
  authorizationCodeMissingFromServerResponse: authorizationCodeMissingFromServerResponse,
715
719
  bindingKeyNotRemoved: bindingKeyNotRemoved,
716
720
  cannotAppendScopeSet: cannotAppendScopeSet,
@@ -725,7 +729,6 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
725
729
  invalidCacheRecord: invalidCacheRecord,
726
730
  invalidState: invalidState,
727
731
  keyIdMissing: keyIdMissing,
728
- maxAgeTranspired: maxAgeTranspired,
729
732
  methodNotImplemented: methodNotImplemented,
730
733
  misplacedResourceParam: misplacedResourceParam,
731
734
  multipleMatchingAppMetadata: multipleMatchingAppMetadata,
@@ -751,7 +754,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
751
754
  userCanceled: userCanceled
752
755
  });
753
756
 
754
- /*! @azure/msal-common v16.8.0 2026-06-10 */
757
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
755
758
 
756
759
  /*
757
760
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -763,7 +766,8 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
763
766
  * to ensure uniqueness of strings.
764
767
  */
765
768
  class ScopeSet {
766
- constructor(inputScopes) {
769
+ constructor(inputScopes, correlationId) {
770
+ this.correlationId = correlationId;
767
771
  // Filter empty string and null/undefined array items
768
772
  const scopeArr = inputScopes
769
773
  ? StringUtils.trimArrayEntries([...inputScopes])
@@ -773,7 +777,7 @@ class ScopeSet {
773
777
  : [];
774
778
  // Check if scopes array has at least one member
775
779
  if (!filteredInput || !filteredInput.length) {
776
- throw createClientConfigurationError(emptyInputScopesError);
780
+ throw createClientConfigurationError(emptyInputScopesError, correlationId);
777
781
  }
778
782
  this.scopes = new Set(); // Iterator in constructor not supported by IE11
779
783
  filteredInput.forEach((scope) => this.scopes.add(scope));
@@ -784,22 +788,22 @@ class ScopeSet {
784
788
  * @param appClientId
785
789
  * @param scopesRequired
786
790
  */
787
- static fromString(inputScopeString) {
791
+ static fromString(inputScopeString, correlationId) {
788
792
  const scopeString = inputScopeString || "";
789
793
  const inputScopes = scopeString.split(" ");
790
- return new ScopeSet(inputScopes);
794
+ return new ScopeSet(inputScopes, correlationId);
791
795
  }
792
796
  /**
793
797
  * Creates the set of scopes to search for in cache lookups
794
798
  * @param inputScopeString
795
799
  * @returns
796
800
  */
797
- static createSearchScopes(inputScopeString) {
801
+ static createSearchScopes(inputScopeString, correlationId) {
798
802
  // Handle empty scopes by using default OIDC scopes for cache lookup
799
803
  const scopesToUse = inputScopeString && inputScopeString.length > 0
800
804
  ? inputScopeString
801
805
  : [...OIDC_DEFAULT_SCOPES];
802
- const scopeSet = new ScopeSet(scopesToUse);
806
+ const scopeSet = new ScopeSet(scopesToUse, correlationId);
803
807
  if (!scopeSet.containsOnlyOIDCScopes()) {
804
808
  scopeSet.removeOIDCScopes();
805
809
  }
@@ -814,7 +818,7 @@ class ScopeSet {
814
818
  */
815
819
  containsScope(scope) {
816
820
  const lowerCaseScopes = this.printScopesLowerCase().split(" ");
817
- const lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);
821
+ const lowerCaseScopesSet = new ScopeSet(lowerCaseScopes, this.correlationId);
818
822
  // compare lowercase scopes
819
823
  return scope
820
824
  ? lowerCaseScopesSet.scopes.has(scope.toLowerCase())
@@ -861,7 +865,7 @@ class ScopeSet {
861
865
  newScopes.forEach((newScope) => this.appendScope(newScope));
862
866
  }
863
867
  catch (e) {
864
- throw createClientAuthError(cannotAppendScopeSet);
868
+ throw createClientAuthError(cannotAppendScopeSet, this.correlationId);
865
869
  }
866
870
  }
867
871
  /**
@@ -870,7 +874,7 @@ class ScopeSet {
870
874
  */
871
875
  removeScope(scope) {
872
876
  if (!scope) {
873
- throw createClientAuthError(cannotRemoveEmptyScope);
877
+ throw createClientAuthError(cannotRemoveEmptyScope, this.correlationId);
874
878
  }
875
879
  this.scopes.delete(scope.trim());
876
880
  }
@@ -889,7 +893,7 @@ class ScopeSet {
889
893
  */
890
894
  unionScopeSets(otherScopes) {
891
895
  if (!otherScopes) {
892
- throw createClientAuthError(emptyInputScopeSet);
896
+ throw createClientAuthError(emptyInputScopeSet, this.correlationId);
893
897
  }
894
898
  const unionScopes = new Set(); // Iterator in constructor not supported in IE11
895
899
  otherScopes.scopes.forEach((scope) => unionScopes.add(scope.toLowerCase()));
@@ -902,7 +906,7 @@ class ScopeSet {
902
906
  */
903
907
  intersectingScopeSets(otherScopes) {
904
908
  if (!otherScopes) {
905
- throw createClientAuthError(emptyInputScopeSet);
909
+ throw createClientAuthError(emptyInputScopeSet, this.correlationId);
906
910
  }
907
911
  // Do not allow OIDC scopes to be the only intersecting scopes
908
912
  if (!otherScopes.containsOnlyOIDCScopes()) {
@@ -946,7 +950,7 @@ class ScopeSet {
946
950
  }
947
951
  }
948
952
 
949
- /*! @azure/msal-common v16.8.0 2026-06-10 */
953
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
950
954
 
951
955
  /*
952
956
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -984,7 +988,7 @@ function addResponseMode(parameters, responseMode) {
984
988
  * @param scopeSet
985
989
  * @param addOidcScopes
986
990
  */
987
- function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
991
+ function addScopes(parameters, scopes, correlationId, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
988
992
  // Always add openid to the scopes when adding OIDC scopes
989
993
  if (addOidcScopes &&
990
994
  !defaultScopes.includes("openid") &&
@@ -994,7 +998,7 @@ function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OID
994
998
  const requestScopes = addOidcScopes
995
999
  ? [...(scopes || []), ...defaultScopes]
996
1000
  : scopes || [];
997
- const scopeSet = new ScopeSet(requestScopes);
1001
+ const scopeSet = new ScopeSet(requestScopes, correlationId);
998
1002
  parameters.set(SCOPE, scopeSet.printScopes());
999
1003
  }
1000
1004
  /**
@@ -1064,26 +1068,18 @@ function addSid(parameters, sid) {
1064
1068
  * Adds claims to request parameters, conditionally excluding clientCapabilities
1065
1069
  * when skipBrokerClaims is true and a brokered flow is in effect.
1066
1070
  * @param parameters - The request parameters map
1071
+ * @param correlationId - The request correlation id
1067
1072
  * @param claims - The claims string from the request
1068
1073
  * @param clientCapabilities - The client capabilities from configuration
1069
1074
  * @param skipBrokerClaims - When true and BROKER_CLIENT_ID is present, excludes clientCapabilities from claims
1070
1075
  */
1071
- function addClaims(parameters, claims, clientCapabilities, skipBrokerClaims) {
1076
+ function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
1072
1077
  // Skip clientCapabilities if skipBrokerClaims is set to true and this is a brokered authentication flow
1073
1078
  const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID)
1074
1079
  ? undefined
1075
1080
  : clientCapabilities;
1076
- if (!StringUtils.isEmptyObj(claims) ||
1077
- (configClaims && configClaims.length > 0)) {
1078
- const mergedClaims = addClientCapabilitiesToClaims(claims, configClaims);
1079
- try {
1080
- JSON.parse(mergedClaims);
1081
- }
1082
- catch (e) {
1083
- throw createClientConfigurationError(invalidClaims);
1084
- }
1085
- parameters.set(CLAIMS, mergedClaims);
1086
- }
1081
+ const mergedClaims = buildMergedClaims(claims, configClaims, correlationId);
1082
+ parameters.set(CLAIMS, mergedClaims);
1087
1083
  }
1088
1084
  /**
1089
1085
  * add correlationId
@@ -1154,7 +1150,7 @@ function addCodeChallengeParams(parameters, codeChallenge, codeChallengeMethod)
1154
1150
  parameters.set(CODE_CHALLENGE_METHOD, codeChallengeMethod);
1155
1151
  }
1156
1152
  else {
1157
- throw createClientConfigurationError(pkceParamsMissing);
1153
+ throw createClientConfigurationError(pkceParamsMissing, "");
1158
1154
  }
1159
1155
  }
1160
1156
  /**
@@ -1260,7 +1256,23 @@ function addExtraParameters(parameters, extraParams) {
1260
1256
  }
1261
1257
  });
1262
1258
  }
1263
- function addClientCapabilitiesToClaims(claims, clientCapabilities) {
1259
+ /**
1260
+ * Default optional idToken claims requested on all auth requests.
1261
+ * signin_state enables KMSI detection; login_hint enables login hint propagation.
1262
+ */
1263
+ const DEFAULT_ID_TOKEN_CLAIMS = {
1264
+ [ClaimsRequestKeys.SIGNIN_STATE]: { essential: false },
1265
+ [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
1266
+ };
1267
+ /**
1268
+ * Parses claims JSON, merges default optional idToken claims (signin_state, login_hint),
1269
+ * and appends client capabilities (xms_cc) to the access_token section.
1270
+ * Does not overwrite idToken claims already specified by the caller.
1271
+ * @param claims - Existing claims JSON string from the request (may be undefined)
1272
+ * @param clientCapabilities - Client capabilities array from configuration
1273
+ * @returns Merged claims JSON string
1274
+ */
1275
+ function buildMergedClaims(claims, clientCapabilities, correlationId = "") {
1264
1276
  let mergedClaims;
1265
1277
  // Parse provided claims into JSON object or initialize empty object
1266
1278
  if (!claims) {
@@ -1268,14 +1280,31 @@ function addClientCapabilitiesToClaims(claims, clientCapabilities) {
1268
1280
  }
1269
1281
  else {
1270
1282
  try {
1271
- mergedClaims = JSON.parse(claims);
1283
+ const parsed = JSON.parse(claims);
1284
+ if (typeof parsed !== "object" ||
1285
+ parsed === null ||
1286
+ Array.isArray(parsed)) {
1287
+ throw new Error("Claims must be a JSON object");
1288
+ }
1289
+ mergedClaims = parsed;
1272
1290
  }
1273
1291
  catch (e) {
1274
- throw createClientConfigurationError(invalidClaims);
1292
+ throw createClientConfigurationError(invalidClaims, correlationId);
1275
1293
  }
1276
1294
  }
1295
+ // Add default optional idToken claims
1296
+ if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
1297
+ mergedClaims[ClaimsRequestKeys.ID_TOKEN] = {};
1298
+ }
1299
+ const idTokenClaims = mergedClaims[ClaimsRequestKeys.ID_TOKEN];
1300
+ for (const [key, value] of Object.entries(DEFAULT_ID_TOKEN_CLAIMS)) {
1301
+ if (!(key in idTokenClaims)) {
1302
+ idTokenClaims[key] = value;
1303
+ }
1304
+ }
1305
+ // Add client capabilities
1277
1306
  if (clientCapabilities && clientCapabilities.length > 0) {
1278
- if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
1307
+ if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ACCESS_TOKEN)) {
1279
1308
  // Add access_token key to claims object
1280
1309
  mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
1281
1310
  }
@@ -1322,16 +1351,11 @@ function addSshJwk(parameters, sshJwkString) {
1322
1351
  /**
1323
1352
  * add server telemetry fields
1324
1353
  * @param serverTelemetryManager
1354
+ * @internal
1325
1355
  */
1326
1356
  function addServerTelemetry(parameters, serverTelemetryManager) {
1327
- const currentTelemetryHeader = serverTelemetryManager.generateCurrentRequestHeaderValue();
1328
- const lastTelemetryHeader = serverTelemetryManager.generateLastRequestHeaderValue();
1329
- if (currentTelemetryHeader) {
1330
- parameters.set(X_CLIENT_CURR_TELEM, currentTelemetryHeader);
1331
- }
1332
- if (lastTelemetryHeader) {
1333
- parameters.set(X_CLIENT_LAST_TELEM, lastTelemetryHeader);
1334
- }
1357
+ parameters.set(X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
1358
+ parameters.set(X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
1335
1359
  }
1336
1360
  /**
1337
1361
  * Adds parameter that indicates to the server that throttling is supported
@@ -1359,7 +1383,7 @@ function addResource(parameters, resource) {
1359
1383
  }
1360
1384
  }
1361
1385
 
1362
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1386
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1363
1387
 
1364
1388
  /*
1365
1389
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1402,7 +1426,7 @@ function getDeserializedResponse(responseString) {
1402
1426
  }
1403
1427
  }
1404
1428
  catch (e) {
1405
- throw createClientAuthError(hashNotDeserialized);
1429
+ throw createClientAuthError(hashNotDeserialized, "");
1406
1430
  }
1407
1431
  return null;
1408
1432
  }
@@ -1417,7 +1441,7 @@ function mapToQueryString(parameters) {
1417
1441
  return queryParameterArray.join("&");
1418
1442
  }
1419
1443
 
1420
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1444
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1421
1445
 
1422
1446
  /*
1423
1447
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1425,38 +1449,38 @@ function mapToQueryString(parameters) {
1425
1449
  */
1426
1450
  const DEFAULT_CRYPTO_IMPLEMENTATION = {
1427
1451
  createNewGuid: () => {
1428
- throw createClientAuthError(methodNotImplemented);
1452
+ throw createClientAuthError(methodNotImplemented, "");
1429
1453
  },
1430
1454
  base64Decode: () => {
1431
- throw createClientAuthError(methodNotImplemented);
1455
+ throw createClientAuthError(methodNotImplemented, "");
1432
1456
  },
1433
1457
  base64Encode: () => {
1434
- throw createClientAuthError(methodNotImplemented);
1458
+ throw createClientAuthError(methodNotImplemented, "");
1435
1459
  },
1436
1460
  base64UrlEncode: () => {
1437
- throw createClientAuthError(methodNotImplemented);
1461
+ throw createClientAuthError(methodNotImplemented, "");
1438
1462
  },
1439
1463
  encodeKid: () => {
1440
- throw createClientAuthError(methodNotImplemented);
1464
+ throw createClientAuthError(methodNotImplemented, "");
1441
1465
  },
1442
1466
  async getPublicKeyThumbprint() {
1443
- throw createClientAuthError(methodNotImplemented);
1467
+ throw createClientAuthError(methodNotImplemented, "");
1444
1468
  },
1445
1469
  async removeTokenBindingKey() {
1446
- throw createClientAuthError(methodNotImplemented);
1470
+ throw createClientAuthError(methodNotImplemented, "");
1447
1471
  },
1448
1472
  async clearKeystore() {
1449
- throw createClientAuthError(methodNotImplemented);
1473
+ throw createClientAuthError(methodNotImplemented, "");
1450
1474
  },
1451
1475
  async signJwt() {
1452
- throw createClientAuthError(methodNotImplemented);
1476
+ throw createClientAuthError(methodNotImplemented, "");
1453
1477
  },
1454
1478
  async hashString() {
1455
- throw createClientAuthError(methodNotImplemented);
1479
+ throw createClientAuthError(methodNotImplemented, "");
1456
1480
  },
1457
1481
  };
1458
1482
 
1459
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1483
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1460
1484
  /*
1461
1485
  * Copyright (c) Microsoft Corporation. All rights reserved.
1462
1486
  * Licensed under the MIT License.
@@ -1519,22 +1543,36 @@ function addLogToCache(correlationId, loggedMessage) {
1519
1543
  }
1520
1544
  }
1521
1545
  /**
1522
- * Checks if a string is already a hashed logging string (6 alphanumeric characters)
1523
- */
1524
- function isHashedString(str) {
1525
- if (str.length !== 6) {
1526
- return false;
1546
+ * Extracts the leading minification hash from a log message, if present.
1547
+ *
1548
+ * Minified messages are produced by the logger-minify rollup plugin and are
1549
+ * either a bare 6-character alphanumeric hash, or that hash followed by a space
1550
+ * and runtime variables appended for local (console) logging, e.g.
1551
+ * "abc123 user-1 popup". Only the leading hash is returned so that telemetry
1552
+ * never captures the appended variables. Returns null when the message is not
1553
+ * a minified message.
1554
+ */
1555
+ function getMessageHash(str) {
1556
+ if (str.length < 6) {
1557
+ return null;
1558
+ }
1559
+ /*
1560
+ * If the message is longer than the hash, the hash must be delimited by a
1561
+ * space (the separator the plugin inserts before appended variables).
1562
+ */
1563
+ if (str.length > 6 && str[6] !== " ") {
1564
+ return null;
1527
1565
  }
1528
- for (let i = 0; i < str.length; i++) {
1566
+ for (let i = 0; i < 6; i++) {
1529
1567
  const char = str[i];
1530
1568
  const isAlphaNumeric = (char >= "a" && char <= "z") ||
1531
1569
  (char >= "A" && char <= "Z") ||
1532
1570
  (char >= "0" && char <= "9");
1533
1571
  if (!isAlphaNumeric) {
1534
- return false;
1572
+ return null;
1535
1573
  }
1536
1574
  }
1537
- return true;
1575
+ return str.substring(0, 6);
1538
1576
  }
1539
1577
  /**
1540
1578
  * Class which facilitates logging of messages to a specific place.
@@ -1581,10 +1619,10 @@ class Logger {
1581
1619
  */
1582
1620
  logMessage(logMessage, options) {
1583
1621
  const correlationId = options.correlationId;
1584
- const isHashedInput = isHashedString(logMessage);
1585
- if (isHashedInput) {
1622
+ const messageHash = getMessageHash(logMessage);
1623
+ if (messageHash) {
1586
1624
  const loggedMessage = {
1587
- hash: logMessage,
1625
+ hash: messageHash,
1588
1626
  level: options.logLevel,
1589
1627
  containsPii: options.containsPii || false,
1590
1628
  milliseconds: 0, // Will be calculated in addLogToCache
@@ -1717,12 +1755,12 @@ class Logger {
1717
1755
  }
1718
1756
  }
1719
1757
 
1720
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1758
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1721
1759
  /* eslint-disable header/header */
1722
1760
  const name$1 = "@azure/msal-common";
1723
- const version$1 = "16.8.0";
1761
+ const version$1 = "16.10.0";
1724
1762
 
1725
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1763
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1726
1764
  /*
1727
1765
  * Copyright (c) Microsoft Corporation. All rights reserved.
1728
1766
  * Licensed under the MIT License.
@@ -1742,7 +1780,74 @@ const AzureCloudInstance = {
1742
1780
  AzureUsGovernment: "https://login.microsoftonline.us",
1743
1781
  };
1744
1782
 
1745
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1783
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1784
+
1785
+ /*
1786
+ * Copyright (c) Microsoft Corporation. All rights reserved.
1787
+ * Licensed under the MIT License.
1788
+ */
1789
+ /**
1790
+ * Extract token by decoding the rawToken
1791
+ *
1792
+ * @param encodedToken
1793
+ */
1794
+ function extractTokenClaims(encodedToken, base64Decode, correlationId) {
1795
+ const jswPayload = getJWSPayload(encodedToken, correlationId);
1796
+ // token will be decoded to get the username
1797
+ try {
1798
+ // base64Decode() should throw an error if there is an issue
1799
+ const base64Decoded = base64Decode(jswPayload);
1800
+ return JSON.parse(base64Decoded);
1801
+ }
1802
+ catch (err) {
1803
+ throw createClientAuthError(tokenParsingError, correlationId);
1804
+ }
1805
+ }
1806
+ /**
1807
+ * Check if the signin_state claim contains "kmsi"
1808
+ * @param idTokenClaims
1809
+ * @returns
1810
+ */
1811
+ function isKmsi(idTokenClaims) {
1812
+ if (!idTokenClaims.signin_state) {
1813
+ return false;
1814
+ }
1815
+ /**
1816
+ * Signin_state claim known values:
1817
+ * dvc_mngd - device is managed
1818
+ * dvc_dmjd - device is domain joined
1819
+ * kmsi - user opted to "keep me signed in"
1820
+ * inknownntwk - Request made inside a known network. Don't use this, use CAE instead.
1821
+ */
1822
+ const kmsiClaims = ["kmsi", "dvc_dmjd"]; // There are some cases where kmsi may not be returned but persistent storage is still OK - allow dvc_dmjd as well
1823
+ return idTokenClaims.signin_state.some((value) => kmsiClaims.includes(value.trim().toLowerCase()));
1824
+ }
1825
+ /**
1826
+ * decode a JWT
1827
+ *
1828
+ * @param authToken
1829
+ */
1830
+ function getJWSPayload(authToken, correlationId) {
1831
+ if (!authToken) {
1832
+ throw createClientAuthError(nullOrEmptyToken, correlationId);
1833
+ }
1834
+ const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
1835
+ const matches = tokenPartsRegex.exec(authToken);
1836
+ if (!matches || matches.length < 4) {
1837
+ throw createClientAuthError(tokenParsingError, correlationId);
1838
+ }
1839
+ /**
1840
+ * const crackedToken = {
1841
+ * header: matches[1],
1842
+ * JWSPayload: matches[2],
1843
+ * JWSSig: matches[3],
1844
+ * };
1845
+ */
1846
+ return matches[2];
1847
+ }
1848
+
1849
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1850
+
1746
1851
  /*
1747
1852
  * Copyright (c) Microsoft Corporation. All rights reserved.
1748
1853
  * Licensed under the MIT License.
@@ -1763,10 +1868,11 @@ function tenantIdMatchesHomeTenant(tenantId, homeAccountId) {
1763
1868
  * @param homeAccountId - Home account identifier for this account object
1764
1869
  * @param localAccountId - Local account identifer for this account object
1765
1870
  * @param tenantId - Full tenant or organizational id that this account belongs to
1871
+ * @param nativeAccountId - Native account identifier for this tenant
1766
1872
  * @param idTokenClaims - Claims from the ID token
1767
1873
  * @returns
1768
1874
  */
1769
- function buildTenantProfile(homeAccountId, localAccountId, tenantId, idTokenClaims) {
1875
+ function buildTenantProfile(homeAccountId, localAccountId, tenantId, nativeAccountId, idTokenClaims) {
1770
1876
  if (idTokenClaims) {
1771
1877
  const { oid, sub, tid, name, tfp, acr, preferred_username, upn, login_hint, } = idTokenClaims;
1772
1878
  /**
@@ -1784,6 +1890,7 @@ function buildTenantProfile(homeAccountId, localAccountId, tenantId, idTokenClai
1784
1890
  loginHint: login_hint,
1785
1891
  isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
1786
1892
  upn: upn,
1893
+ ...(nativeAccountId && { nativeAccountId }),
1787
1894
  };
1788
1895
  }
1789
1896
  else {
@@ -1792,6 +1899,7 @@ function buildTenantProfile(homeAccountId, localAccountId, tenantId, idTokenClai
1792
1899
  localAccountId,
1793
1900
  username: "",
1794
1901
  isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
1902
+ ...(nativeAccountId && { nativeAccountId }),
1795
1903
  };
1796
1904
  }
1797
1905
  }
@@ -1813,99 +1921,20 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1813
1921
  if (idTokenClaims) {
1814
1922
  // Ignore isHomeTenant which is a utility property of tenant profile but not required in base account info
1815
1923
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1816
- const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, idTokenClaims);
1924
+ const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, updatedAccountInfo.nativeAccountId, idTokenClaims);
1817
1925
  updatedAccountInfo = {
1818
1926
  ...updatedAccountInfo,
1819
1927
  ...claimsSourcedTenantProfile,
1820
1928
  idTokenClaims: idTokenClaims,
1821
1929
  idToken: idTokenSecret,
1930
+ kmsi: isKmsi(idTokenClaims),
1822
1931
  };
1823
1932
  return updatedAccountInfo;
1824
1933
  }
1825
1934
  return updatedAccountInfo;
1826
1935
  }
1827
1936
 
1828
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1829
-
1830
- /*
1831
- * Copyright (c) Microsoft Corporation. All rights reserved.
1832
- * Licensed under the MIT License.
1833
- */
1834
- /**
1835
- * Extract token by decoding the rawToken
1836
- *
1837
- * @param encodedToken
1838
- */
1839
- function extractTokenClaims(encodedToken, base64Decode) {
1840
- const jswPayload = getJWSPayload(encodedToken);
1841
- // token will be decoded to get the username
1842
- try {
1843
- // base64Decode() should throw an error if there is an issue
1844
- const base64Decoded = base64Decode(jswPayload);
1845
- return JSON.parse(base64Decoded);
1846
- }
1847
- catch (err) {
1848
- throw createClientAuthError(tokenParsingError);
1849
- }
1850
- }
1851
- /**
1852
- * Check if the signin_state claim contains "kmsi"
1853
- * @param idTokenClaims
1854
- * @returns
1855
- */
1856
- function isKmsi(idTokenClaims) {
1857
- if (!idTokenClaims.signin_state) {
1858
- return false;
1859
- }
1860
- /**
1861
- * Signin_state claim known values:
1862
- * dvc_mngd - device is managed
1863
- * dvc_dmjd - device is domain joined
1864
- * kmsi - user opted to "keep me signed in"
1865
- * inknownntwk - Request made inside a known network. Don't use this, use CAE instead.
1866
- */
1867
- const kmsiClaims = ["kmsi", "dvc_dmjd"]; // There are some cases where kmsi may not be returned but persistent storage is still OK - allow dvc_dmjd as well
1868
- return idTokenClaims.signin_state.some((value) => kmsiClaims.includes(value.trim().toLowerCase()));
1869
- }
1870
- /**
1871
- * decode a JWT
1872
- *
1873
- * @param authToken
1874
- */
1875
- function getJWSPayload(authToken) {
1876
- if (!authToken) {
1877
- throw createClientAuthError(nullOrEmptyToken);
1878
- }
1879
- const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
1880
- const matches = tokenPartsRegex.exec(authToken);
1881
- if (!matches || matches.length < 4) {
1882
- throw createClientAuthError(tokenParsingError);
1883
- }
1884
- /**
1885
- * const crackedToken = {
1886
- * header: matches[1],
1887
- * JWSPayload: matches[2],
1888
- * JWSSig: matches[3],
1889
- * };
1890
- */
1891
- return matches[2];
1892
- }
1893
- /**
1894
- * Determine if the token's max_age has transpired
1895
- */
1896
- function checkMaxAge(authTime, maxAge) {
1897
- /*
1898
- * per https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
1899
- * To force an immediate re-authentication: If an app requires that a user re-authenticate prior to access,
1900
- * provide a value of 0 for the max_age parameter and the AS will force a fresh login.
1901
- */
1902
- const fiveMinuteSkew = 300000; // five minutes in milliseconds
1903
- if (maxAge === 0 || Date.now() - fiveMinuteSkew > authTime + maxAge) {
1904
- throw createClientAuthError(maxAgeTranspired);
1905
- }
1906
- }
1907
-
1908
- /*! @azure/msal-common v16.8.0 2026-06-10 */
1937
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
1909
1938
 
1910
1939
  /*
1911
1940
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1918,11 +1947,12 @@ class UrlString {
1918
1947
  get urlString() {
1919
1948
  return this._urlString;
1920
1949
  }
1921
- constructor(url) {
1950
+ constructor(url, correlationId) {
1922
1951
  this._urlString = url;
1952
+ this.correlationId = correlationId;
1923
1953
  if (!this._urlString) {
1924
1954
  // Throws error if url is empty
1925
- throw createClientConfigurationError(urlEmptyError);
1955
+ throw createClientConfigurationError(urlEmptyError, correlationId);
1926
1956
  }
1927
1957
  if (!url.includes("#")) {
1928
1958
  this._urlString = UrlString.canonicalizeUri(url);
@@ -1958,16 +1988,16 @@ class UrlString {
1958
1988
  components = this.getUrlComponents();
1959
1989
  }
1960
1990
  catch (e) {
1961
- throw createClientConfigurationError(urlParseError);
1991
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1962
1992
  }
1963
1993
  // Throw error if URI or path segments are not parseable.
1964
1994
  if (!components.HostNameAndPort || !components.PathSegments) {
1965
- throw createClientConfigurationError(urlParseError);
1995
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1966
1996
  }
1967
1997
  // Throw error if uri is insecure.
1968
1998
  if (!components.Protocol ||
1969
1999
  components.Protocol.toLowerCase() !== "https:") {
1970
- throw createClientConfigurationError(authorityUriInsecure);
2000
+ throw createClientConfigurationError(authorityUriInsecure, this.correlationId);
1971
2001
  }
1972
2002
  }
1973
2003
  /**
@@ -2004,7 +2034,7 @@ class UrlString {
2004
2034
  pathArray[0] === AADAuthority.ORGANIZATIONS)) {
2005
2035
  pathArray[0] = tenantId;
2006
2036
  }
2007
- return UrlString.constructAuthorityUriFromObject(urlObject);
2037
+ return UrlString.constructAuthorityUriFromObject(urlObject, this.correlationId);
2008
2038
  }
2009
2039
  /**
2010
2040
  * Parses out the components from a url string.
@@ -2016,7 +2046,7 @@ class UrlString {
2016
2046
  // If url string does not match regEx, we throw an error
2017
2047
  const match = this.urlString.match(regEx);
2018
2048
  if (!match) {
2019
- throw createClientConfigurationError(urlParseError);
2049
+ throw createClientConfigurationError(urlParseError, this.correlationId);
2020
2050
  }
2021
2051
  // Url component object
2022
2052
  const urlComponents = {
@@ -2034,17 +2064,17 @@ class UrlString {
2034
2064
  }
2035
2065
  return urlComponents;
2036
2066
  }
2037
- static getDomainFromUrl(url) {
2067
+ static getDomainFromUrl(url, correlationId) {
2038
2068
  const regEx = RegExp("^([^:/?#]+://)?([^/?#]*)");
2039
2069
  const match = url.match(regEx);
2040
2070
  if (!match) {
2041
- throw createClientConfigurationError(urlParseError);
2071
+ throw createClientConfigurationError(urlParseError, correlationId);
2042
2072
  }
2043
2073
  return match[2];
2044
2074
  }
2045
- static getAbsoluteUrl(relativeUrl, baseUrl) {
2075
+ static getAbsoluteUrl(relativeUrl, baseUrl, correlationId) {
2046
2076
  if (relativeUrl[0] === FORWARD_SLASH) {
2047
- const url = new UrlString(baseUrl);
2077
+ const url = new UrlString(baseUrl, correlationId);
2048
2078
  const baseComponents = url.getUrlComponents();
2049
2079
  return (baseComponents.Protocol +
2050
2080
  "//" +
@@ -2053,16 +2083,16 @@ class UrlString {
2053
2083
  }
2054
2084
  return relativeUrl;
2055
2085
  }
2056
- static constructAuthorityUriFromObject(urlObject) {
2086
+ static constructAuthorityUriFromObject(urlObject, correlationId) {
2057
2087
  return new UrlString(urlObject.Protocol +
2058
2088
  "//" +
2059
2089
  urlObject.HostNameAndPort +
2060
2090
  "/" +
2061
- urlObject.PathSegments.join("/"));
2091
+ urlObject.PathSegments.join("/"), correlationId);
2062
2092
  }
2063
2093
  }
2064
2094
 
2065
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2095
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2066
2096
 
2067
2097
  /*
2068
2098
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2178,7 +2208,7 @@ function getAliasesFromStaticSources(staticAuthorityOptions, logger, correlation
2178
2208
  let staticAliases;
2179
2209
  const canonicalAuthority = staticAuthorityOptions.canonicalAuthority;
2180
2210
  if (canonicalAuthority) {
2181
- const authorityHost = new UrlString(canonicalAuthority).getUrlComponents().HostNameAndPort;
2211
+ const authorityHost = new UrlString(canonicalAuthority, correlationId).getUrlComponents().HostNameAndPort;
2182
2212
  staticAliases =
2183
2213
  getAliasesFromMetadata(logger, correlationId, authorityHost, staticAuthorityOptions.cloudDiscoveryMetadata?.metadata, AuthorityMetadataSource.CONFIG) ||
2184
2214
  getAliasesFromMetadata(logger, correlationId, authorityHost, InstanceDiscoveryMetadata.metadata, AuthorityMetadataSource.HARDCODED_VALUES) ||
@@ -2228,7 +2258,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2228
2258
  return null;
2229
2259
  }
2230
2260
 
2231
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2261
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2232
2262
  /*
2233
2263
  * Copyright (c) Microsoft Corporation. All rights reserved.
2234
2264
  * Licensed under the MIT License.
@@ -2236,7 +2266,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2236
2266
  const cacheQuotaExceeded = "cache_quota_exceeded";
2237
2267
  const cacheErrorUnknown = "cache_error_unknown";
2238
2268
 
2239
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2269
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2240
2270
 
2241
2271
  /*
2242
2272
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2274,7 +2304,7 @@ function createCacheError(e) {
2274
2304
  }
2275
2305
  }
2276
2306
 
2277
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2307
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2278
2308
 
2279
2309
  /*
2280
2310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2287,14 +2317,14 @@ function createCacheError(e) {
2287
2317
  */
2288
2318
  function buildClientInfo(rawClientInfo, base64Decode) {
2289
2319
  if (!rawClientInfo) {
2290
- throw createClientAuthError(clientInfoEmptyError);
2320
+ throw createClientAuthError(clientInfoEmptyError, "");
2291
2321
  }
2292
2322
  try {
2293
2323
  const decodedClientInfo = base64Decode(rawClientInfo);
2294
2324
  return JSON.parse(decodedClientInfo);
2295
2325
  }
2296
2326
  catch (e) {
2297
- throw createClientAuthError(clientInfoDecodingError);
2327
+ throw createClientAuthError(clientInfoDecodingError, "");
2298
2328
  }
2299
2329
  }
2300
2330
  /**
@@ -2303,7 +2333,7 @@ function buildClientInfo(rawClientInfo, base64Decode) {
2303
2333
  */
2304
2334
  function buildClientInfoFromHomeAccountId(homeAccountId) {
2305
2335
  if (!homeAccountId) {
2306
- throw createClientAuthError(clientInfoDecodingError);
2336
+ throw createClientAuthError(clientInfoDecodingError, "");
2307
2337
  }
2308
2338
  const clientInfoParts = homeAccountId.split(CLIENT_INFO_SEPARATOR, 2);
2309
2339
  return {
@@ -2312,7 +2342,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2312
2342
  };
2313
2343
  }
2314
2344
 
2315
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2345
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2316
2346
  /*
2317
2347
  * Copyright (c) Microsoft Corporation. All rights reserved.
2318
2348
  * Licensed under the MIT License.
@@ -2327,7 +2357,7 @@ const AuthorityType = {
2327
2357
  Ciam: 3,
2328
2358
  };
2329
2359
 
2330
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2360
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2331
2361
  /*
2332
2362
  * Copyright (c) Microsoft Corporation. All rights reserved.
2333
2363
  * Licensed under the MIT License.
@@ -2349,7 +2379,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2349
2379
  return null;
2350
2380
  }
2351
2381
 
2352
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2382
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2353
2383
  /*
2354
2384
  * Copyright (c) Microsoft Corporation. All rights reserved.
2355
2385
  * Licensed under the MIT License.
@@ -2373,9 +2403,10 @@ const ProtocolMode = {
2373
2403
  EAR: "EAR",
2374
2404
  };
2375
2405
 
2376
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2406
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2377
2407
  /**
2378
2408
  * Returns the AccountInfo interface for this account.
2409
+ * @internal
2379
2410
  */
2380
2411
  function getAccountInfo(accountEntity) {
2381
2412
  const tenantProfiles = accountEntity.tenantProfiles || [];
@@ -2383,8 +2414,11 @@ function getAccountInfo(accountEntity) {
2383
2414
  if (tenantProfiles.length === 0 &&
2384
2415
  accountEntity.realm &&
2385
2416
  accountEntity.localAccountId) {
2386
- tenantProfiles.push(buildTenantProfile(accountEntity.homeAccountId, accountEntity.localAccountId, accountEntity.realm));
2417
+ tenantProfiles.push(buildTenantProfile(accountEntity.homeAccountId, accountEntity.localAccountId, accountEntity.realm, accountEntity.nativeAccountId));
2387
2418
  }
2419
+ // Resolve nativeAccountId from the home tenant profile first, fall back to top-level (deprecated) for old cache entries
2420
+ const homeTenantProfile = tenantProfiles.find((tp) => tp.tenantId === accountEntity.realm);
2421
+ const nativeAccountId = homeTenantProfile?.nativeAccountId || accountEntity.nativeAccountId;
2388
2422
  return {
2389
2423
  homeAccountId: accountEntity.homeAccountId,
2390
2424
  environment: accountEntity.environment,
@@ -2393,7 +2427,7 @@ function getAccountInfo(accountEntity) {
2393
2427
  localAccountId: accountEntity.localAccountId,
2394
2428
  loginHint: accountEntity.loginHint,
2395
2429
  name: accountEntity.name,
2396
- nativeAccountId: accountEntity.nativeAccountId,
2430
+ nativeAccountId: nativeAccountId,
2397
2431
  authorityType: accountEntity.authorityType,
2398
2432
  // Deserialize tenant profiles array into a Map
2399
2433
  tenantProfiles: new Map(tenantProfiles.map((tenantProfile) => {
@@ -2405,8 +2439,9 @@ function getAccountInfo(accountEntity) {
2405
2439
  /**
2406
2440
  * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
2407
2441
  * @param accountDetails
2442
+ * @internal
2408
2443
  */
2409
- function createAccountEntity(accountDetails, authority, base64Decode) {
2444
+ function createAccountEntity(accountDetails, authority, correlationId, base64Decode) {
2410
2445
  let authorityType;
2411
2446
  if (authority.authorityType === AuthorityType.Adfs) {
2412
2447
  authorityType = CACHE_ACCOUNT_TYPE_ADFS;
@@ -2428,7 +2463,7 @@ function createAccountEntity(accountDetails, authority, base64Decode) {
2428
2463
  const env = accountDetails.environment ||
2429
2464
  (authority && authority.getPreferredCache());
2430
2465
  if (!env) {
2431
- throw createClientAuthError(invalidCacheEnvironment);
2466
+ throw createClientAuthError(invalidCacheEnvironment, correlationId);
2432
2467
  }
2433
2468
  /*
2434
2469
  * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
@@ -2455,7 +2490,7 @@ function createAccountEntity(accountDetails, authority, base64Decode) {
2455
2490
  tenantProfiles = accountDetails.tenantProfiles;
2456
2491
  }
2457
2492
  else {
2458
- const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, localAccountId, realm, accountDetails.idTokenClaims);
2493
+ const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, localAccountId, realm, accountDetails.nativeAccountId, accountDetails.idTokenClaims);
2459
2494
  tenantProfiles = [tenantProfile];
2460
2495
  }
2461
2496
  return {
@@ -2503,6 +2538,7 @@ function generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, co
2503
2538
  /**
2504
2539
  * Validates an entity: checks for all expected params
2505
2540
  * @param entity
2541
+ * @internal
2506
2542
  */
2507
2543
  function isAccountEntity(entity) {
2508
2544
  if (!entity) {
@@ -2516,7 +2552,7 @@ function isAccountEntity(entity) {
2516
2552
  entity.hasOwnProperty("authorityType"));
2517
2553
  }
2518
2554
 
2519
- /*! @azure/msal-common v16.8.0 2026-06-10 */
2555
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
2520
2556
 
2521
2557
  /*
2522
2558
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2605,7 +2641,7 @@ class CacheManager {
2605
2641
  }
2606
2642
  const idToken = this.getIdToken(accountInfo, correlationId, tokenKeys, tenantProfile.tenantId);
2607
2643
  if (idToken) {
2608
- idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);
2644
+ idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode, correlationId);
2609
2645
  if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {
2610
2646
  // ID token sourced claims don't match so this tenant profile is not a match
2611
2647
  return null;
@@ -2668,6 +2704,11 @@ class CacheManager {
2668
2704
  !(tenantProfile.upn === tenantProfileFilter.upn)) {
2669
2705
  return false;
2670
2706
  }
2707
+ if (!!tenantProfileFilter.nativeAccountId &&
2708
+ tenantProfile.nativeAccountId !==
2709
+ tenantProfileFilter.nativeAccountId) {
2710
+ return false;
2711
+ }
2671
2712
  return true;
2672
2713
  }
2673
2714
  idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter) {
@@ -2705,7 +2746,7 @@ class CacheManager {
2705
2746
  */
2706
2747
  async saveCacheRecord(cacheRecord, correlationId, kmsi, apiId, storeInCache) {
2707
2748
  if (!cacheRecord) {
2708
- throw createClientAuthError(invalidCacheRecord);
2749
+ throw createClientAuthError(invalidCacheRecord, correlationId);
2709
2750
  }
2710
2751
  try {
2711
2752
  if (!!cacheRecord.account) {
@@ -2750,7 +2791,7 @@ class CacheManager {
2750
2791
  tokenType: credential.tokenType,
2751
2792
  };
2752
2793
  const tokenKeys = this.getTokenKeys();
2753
- const currentScopes = ScopeSet.fromString(credential.target);
2794
+ const currentScopes = ScopeSet.fromString(credential.target, correlationId);
2754
2795
  tokenKeys.accessToken.forEach((key) => {
2755
2796
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
2756
2797
  return;
@@ -2758,7 +2799,7 @@ class CacheManager {
2758
2799
  const tokenEntity = this.getAccessTokenCredential(key, correlationId);
2759
2800
  if (tokenEntity &&
2760
2801
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
2761
- const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
2802
+ const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
2762
2803
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
2763
2804
  this.removeAccessToken(key, correlationId);
2764
2805
  }
@@ -2792,10 +2833,6 @@ class CacheManager {
2792
2833
  !this.matchRealm(entity, accountFilter.realm)) {
2793
2834
  return;
2794
2835
  }
2795
- if (!!accountFilter.nativeAccountId &&
2796
- !this.matchNativeAccountId(entity, accountFilter.nativeAccountId)) {
2797
- return;
2798
- }
2799
2836
  if (!!accountFilter.authorityType &&
2800
2837
  !this.matchAuthorityType(entity, accountFilter.authorityType)) {
2801
2838
  return;
@@ -2807,6 +2844,7 @@ class CacheManager {
2807
2844
  username: accountFilter?.username,
2808
2845
  loginHint: accountFilter?.loginHint,
2809
2846
  upn: accountFilter?.upn,
2847
+ nativeAccountId: accountFilter?.nativeAccountId,
2810
2848
  };
2811
2849
  const matchingTenantProfiles = entity.tenantProfiles?.filter((tenantProfile) => {
2812
2850
  return this.tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter);
@@ -2860,7 +2898,8 @@ class CacheManager {
2860
2898
  * idTokens do not have "target", target specific refreshTokens do exist for some types of authentication
2861
2899
  * Resource specific refresh tokens case will be added when the support is deemed necessary
2862
2900
  */
2863
- if (!!filter.target && !this.matchTarget(entity, filter.target)) {
2901
+ if (!!filter.target &&
2902
+ !this.matchTarget(entity, filter.target, correlationId)) {
2864
2903
  return false;
2865
2904
  }
2866
2905
  // Access Token with Auth Scheme specific matching
@@ -2877,6 +2916,28 @@ class CacheManager {
2877
2916
  }
2878
2917
  }
2879
2918
  }
2919
+ // Additional cache key components matching (bidirectional isolation)
2920
+ const entityComponents = entity.additionalCacheKeyComponents;
2921
+ const filterComponents = filter.additionalCacheKeyComponents;
2922
+ const entityHasComponents = !!entityComponents && Object.keys(entityComponents).length > 0;
2923
+ const filterHasComponents = !!filterComponents && Object.keys(filterComponents).length > 0;
2924
+ if (entityHasComponents !== filterHasComponents) {
2925
+ return false;
2926
+ }
2927
+ if (entityHasComponents && filterHasComponents) {
2928
+ const entityKeys = Object.keys(entityComponents).sort();
2929
+ const filterKeys = Object.keys(filterComponents).sort();
2930
+ if (entityKeys.length !== filterKeys.length) {
2931
+ return false;
2932
+ }
2933
+ for (let i = 0; i < entityKeys.length; i++) {
2934
+ if (entityKeys[i] !== filterKeys[i] ||
2935
+ entityComponents[entityKeys[i]] !==
2936
+ filterComponents[filterKeys[i]]) {
2937
+ return false;
2938
+ }
2939
+ }
2940
+ }
2880
2941
  return true;
2881
2942
  }
2882
2943
  /**
@@ -3144,7 +3205,7 @@ class CacheManager {
3144
3205
  getAccessToken(account, request, tokenKeys, targetRealm) {
3145
3206
  const correlationId = request.correlationId;
3146
3207
  this.commonLogger.trace("CacheManager - getAccessToken called", correlationId);
3147
- const scopes = ScopeSet.createSearchScopes(request.scopes);
3208
+ const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
3148
3209
  const authScheme = request.authenticationScheme ||
3149
3210
  AuthenticationScheme.BEARER;
3150
3211
  /*
@@ -3334,7 +3395,7 @@ class CacheManager {
3334
3395
  return null;
3335
3396
  }
3336
3397
  else if (numAppMetadata > 1) {
3337
- throw createClientAuthError(multipleMatchingAppMetadata);
3398
+ throw createClientAuthError(multipleMatchingAppMetadata, correlationId);
3338
3399
  }
3339
3400
  return appMetadataEntries[0];
3340
3401
  }
@@ -3464,15 +3525,6 @@ class CacheManager {
3464
3525
  matchRealm(entity, realm) {
3465
3526
  return !!(entity.realm?.toLowerCase() === realm.toLowerCase());
3466
3527
  }
3467
- /**
3468
- * helper to match nativeAccountId
3469
- * @param entity
3470
- * @param nativeAccountId
3471
- * @returns boolean indicating the match result
3472
- */
3473
- matchNativeAccountId(entity, nativeAccountId) {
3474
- return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);
3475
- }
3476
3528
  /**
3477
3529
  * helper to match loginHint which can be either:
3478
3530
  * 1. login_hint ID token claim
@@ -3516,14 +3568,14 @@ class CacheManager {
3516
3568
  * @param entity
3517
3569
  * @param target
3518
3570
  */
3519
- matchTarget(entity, target) {
3571
+ matchTarget(entity, target, correlationId) {
3520
3572
  const isNotAccessTokenCredential = entity.credentialType !== CredentialType.ACCESS_TOKEN &&
3521
3573
  entity.credentialType !==
3522
3574
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
3523
3575
  if (isNotAccessTokenCredential || !entity.target) {
3524
3576
  return false;
3525
3577
  }
3526
- const entityScopeSet = ScopeSet.fromString(entity.target);
3578
+ const entityScopeSet = ScopeSet.fromString(entity.target, correlationId);
3527
3579
  return entityScopeSet.containsScopeSet(target);
3528
3580
  }
3529
3581
  /**
@@ -3577,77 +3629,77 @@ class CacheManager {
3577
3629
  /** @internal */
3578
3630
  class DefaultStorageClass extends CacheManager {
3579
3631
  async setAccount() {
3580
- throw createClientAuthError(methodNotImplemented);
3632
+ throw createClientAuthError(methodNotImplemented, "");
3581
3633
  }
3582
3634
  getAccount() {
3583
- throw createClientAuthError(methodNotImplemented);
3635
+ throw createClientAuthError(methodNotImplemented, "");
3584
3636
  }
3585
3637
  async setIdTokenCredential() {
3586
- throw createClientAuthError(methodNotImplemented);
3638
+ throw createClientAuthError(methodNotImplemented, "");
3587
3639
  }
3588
3640
  getIdTokenCredential() {
3589
- throw createClientAuthError(methodNotImplemented);
3641
+ throw createClientAuthError(methodNotImplemented, "");
3590
3642
  }
3591
3643
  async setAccessTokenCredential() {
3592
- throw createClientAuthError(methodNotImplemented);
3644
+ throw createClientAuthError(methodNotImplemented, "");
3593
3645
  }
3594
3646
  getAccessTokenCredential() {
3595
- throw createClientAuthError(methodNotImplemented);
3647
+ throw createClientAuthError(methodNotImplemented, "");
3596
3648
  }
3597
3649
  async setRefreshTokenCredential() {
3598
- throw createClientAuthError(methodNotImplemented);
3650
+ throw createClientAuthError(methodNotImplemented, "");
3599
3651
  }
3600
3652
  getRefreshTokenCredential() {
3601
- throw createClientAuthError(methodNotImplemented);
3653
+ throw createClientAuthError(methodNotImplemented, "");
3602
3654
  }
3603
3655
  setAppMetadata() {
3604
- throw createClientAuthError(methodNotImplemented);
3656
+ throw createClientAuthError(methodNotImplemented, "");
3605
3657
  }
3606
3658
  getAppMetadata() {
3607
- throw createClientAuthError(methodNotImplemented);
3659
+ throw createClientAuthError(methodNotImplemented, "");
3608
3660
  }
3609
3661
  setServerTelemetry() {
3610
- throw createClientAuthError(methodNotImplemented);
3662
+ throw createClientAuthError(methodNotImplemented, "");
3611
3663
  }
3612
3664
  getServerTelemetry() {
3613
- throw createClientAuthError(methodNotImplemented);
3665
+ throw createClientAuthError(methodNotImplemented, "");
3614
3666
  }
3615
3667
  setAuthorityMetadata() {
3616
- throw createClientAuthError(methodNotImplemented);
3668
+ throw createClientAuthError(methodNotImplemented, "");
3617
3669
  }
3618
3670
  getAuthorityMetadata() {
3619
- throw createClientAuthError(methodNotImplemented);
3671
+ throw createClientAuthError(methodNotImplemented, "");
3620
3672
  }
3621
3673
  getAuthorityMetadataKeys() {
3622
- throw createClientAuthError(methodNotImplemented);
3674
+ throw createClientAuthError(methodNotImplemented, "");
3623
3675
  }
3624
3676
  setThrottlingCache() {
3625
- throw createClientAuthError(methodNotImplemented);
3677
+ throw createClientAuthError(methodNotImplemented, "");
3626
3678
  }
3627
3679
  getThrottlingCache() {
3628
- throw createClientAuthError(methodNotImplemented);
3680
+ throw createClientAuthError(methodNotImplemented, "");
3629
3681
  }
3630
3682
  removeItem() {
3631
- throw createClientAuthError(methodNotImplemented);
3683
+ throw createClientAuthError(methodNotImplemented, "");
3632
3684
  }
3633
3685
  getKeys() {
3634
- throw createClientAuthError(methodNotImplemented);
3686
+ throw createClientAuthError(methodNotImplemented, "");
3635
3687
  }
3636
3688
  getAccountKeys() {
3637
- throw createClientAuthError(methodNotImplemented);
3689
+ throw createClientAuthError(methodNotImplemented, "");
3638
3690
  }
3639
3691
  getTokenKeys() {
3640
- throw createClientAuthError(methodNotImplemented);
3692
+ throw createClientAuthError(methodNotImplemented, "");
3641
3693
  }
3642
3694
  generateCredentialKey() {
3643
- throw createClientAuthError(methodNotImplemented);
3695
+ throw createClientAuthError(methodNotImplemented, "");
3644
3696
  }
3645
3697
  generateAccountKey() {
3646
- throw createClientAuthError(methodNotImplemented);
3698
+ throw createClientAuthError(methodNotImplemented, "");
3647
3699
  }
3648
3700
  }
3649
3701
 
3650
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3702
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3651
3703
  /*
3652
3704
  * Copyright (c) Microsoft Corporation. All rights reserved.
3653
3705
  * Licensed under the MIT License.
@@ -3661,7 +3713,7 @@ class DefaultStorageClass extends CacheManager {
3661
3713
  const PerformanceEventStatus = {
3662
3714
  InProgress: 1};
3663
3715
 
3664
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3716
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3665
3717
 
3666
3718
  /*
3667
3719
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3716,7 +3768,7 @@ class StubPerformanceClient {
3716
3768
  }
3717
3769
  }
3718
3770
 
3719
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3771
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3720
3772
 
3721
3773
  /*
3722
3774
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3736,10 +3788,10 @@ const DEFAULT_LOGGER_IMPLEMENTATION = {
3736
3788
  };
3737
3789
  const DEFAULT_NETWORK_IMPLEMENTATION = {
3738
3790
  async sendGetRequestAsync() {
3739
- throw createClientAuthError(methodNotImplemented);
3791
+ throw createClientAuthError(methodNotImplemented, "");
3740
3792
  },
3741
3793
  async sendPostRequestAsync() {
3742
- throw createClientAuthError(methodNotImplemented);
3794
+ throw createClientAuthError(methodNotImplemented, "");
3743
3795
  },
3744
3796
  };
3745
3797
  const DEFAULT_LIBRARY_INFO = {
@@ -3768,6 +3820,7 @@ const DEFAULT_TELEMETRY_OPTIONS$1 = {
3768
3820
  * @param Configuration
3769
3821
  *
3770
3822
  * @returns Configuration
3823
+ * @internal
3771
3824
  */
3772
3825
  function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
3773
3826
  const loggerOptions = {
@@ -3779,7 +3832,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
3779
3832
  systemOptions: { ...DEFAULT_SYSTEM_OPTIONS$1, ...userSystemOptions },
3780
3833
  loggerOptions: loggerOptions,
3781
3834
  storageInterface: storageImplementation ||
3782
- new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions), new StubPerformanceClient()),
3835
+ new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
3783
3836
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
3784
3837
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
3785
3838
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
@@ -3811,7 +3864,7 @@ function isOidcProtocolMode(config) {
3811
3864
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3812
3865
  }
3813
3866
 
3814
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3867
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3815
3868
  /*
3816
3869
  * Copyright (c) Microsoft Corporation. All rights reserved.
3817
3870
  * Licensed under the MIT License.
@@ -3838,7 +3891,7 @@ function isOidcProtocolMode(config) {
3838
3891
  }
3839
3892
  }
3840
3893
 
3841
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3894
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3842
3895
  /*
3843
3896
  * Copyright (c) Microsoft Corporation. All rights reserved.
3844
3897
  * Licensed under the MIT License.
@@ -3893,7 +3946,7 @@ function delay(t, value) {
3893
3946
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
3894
3947
  }
3895
3948
 
3896
- /*! @azure/msal-common v16.8.0 2026-06-10 */
3949
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
3897
3950
 
3898
3951
  /*
3899
3952
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3929,7 +3982,7 @@ function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tena
3929
3982
  * @param expiresOn
3930
3983
  * @param extExpiresOn
3931
3984
  */
3932
- function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId) {
3985
+ function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, correlationId, refreshOn, tokenType, userAssertionHash, keyId, additionalCacheKeyComponents) {
3933
3986
  const atEntity = {
3934
3987
  homeAccountId: homeAccountId,
3935
3988
  credentialType: CredentialType.ACCESS_TOKEN,
@@ -3961,9 +4014,9 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
3961
4014
  switch (atEntity.tokenType) {
3962
4015
  case AuthenticationScheme.POP:
3963
4016
  // Make sure keyId is present and add it to credential
3964
- const tokenClaims = extractTokenClaims(accessToken, base64Decode);
4017
+ const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
3965
4018
  if (!tokenClaims?.cnf?.kid) {
3966
- throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
4019
+ throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt, correlationId);
3967
4020
  }
3968
4021
  atEntity.keyId = tokenClaims.cnf.kid;
3969
4022
  break;
@@ -3971,6 +4024,11 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
3971
4024
  atEntity.keyId = keyId;
3972
4025
  }
3973
4026
  }
4027
+ /* Additional cache key components for cache isolation (e.g., FMI path) */
4028
+ if (additionalCacheKeyComponents &&
4029
+ Object.keys(additionalCacheKeyComponents).length > 0) {
4030
+ atEntity.additionalCacheKeyComponents = additionalCacheKeyComponents;
4031
+ }
3974
4032
  return atEntity;
3975
4033
  }
3976
4034
  /**
@@ -4130,6 +4188,7 @@ function generateAuthorityMetadataExpiresAt() {
4130
4188
  return (nowSeconds() +
4131
4189
  AUTHORITY_METADATA_REFRESH_TIME_SECONDS);
4132
4190
  }
4191
+ /** @internal */
4133
4192
  function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
4134
4193
  authorityMetadata.authorization_endpoint =
4135
4194
  updatedValues.authorization_endpoint;
@@ -4139,6 +4198,7 @@ function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromN
4139
4198
  authorityMetadata.endpointsFromNetwork = fromNetwork;
4140
4199
  authorityMetadata.jwks_uri = updatedValues.jwks_uri;
4141
4200
  }
4201
+ /** @internal */
4142
4202
  function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {
4143
4203
  authorityMetadata.aliases = updatedValues.aliases;
4144
4204
  authorityMetadata.preferred_cache = updatedValues.preferred_cache;
@@ -4147,12 +4207,13 @@ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetw
4147
4207
  }
4148
4208
  /**
4149
4209
  * Returns whether or not the data needs to be refreshed
4210
+ * @internal
4150
4211
  */
4151
4212
  function isAuthorityMetadataExpired(metadata) {
4152
4213
  return metadata.expiresAt <= nowSeconds();
4153
4214
  }
4154
4215
 
4155
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4216
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4156
4217
  /*
4157
4218
  * Copyright (c) Microsoft Corporation. All rights reserved.
4158
4219
  * Licensed under the MIT License.
@@ -4214,7 +4275,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
4214
4275
  */
4215
4276
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
4216
4277
 
4217
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4278
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4218
4279
  /*
4219
4280
  * Copyright (c) Microsoft Corporation. All rights reserved.
4220
4281
  * Licensed under the MIT License.
@@ -4307,7 +4368,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4307
4368
  };
4308
4369
  };
4309
4370
 
4310
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4371
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4311
4372
 
4312
4373
  /*
4313
4374
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4368,7 +4429,7 @@ class PopTokenGenerator {
4368
4429
  // Deconstruct request to extract SHR parameters
4369
4430
  const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, shrOptions, } = request;
4370
4431
  const resourceUrlString = resourceRequestUri
4371
- ? new UrlString(resourceRequestUri)
4432
+ ? new UrlString(resourceRequestUri, request.correlationId)
4372
4433
  : undefined;
4373
4434
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
4374
4435
  return this.cryptoUtils.signJwt({
@@ -4387,7 +4448,7 @@ class PopTokenGenerator {
4387
4448
  }
4388
4449
  }
4389
4450
 
4390
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4451
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4391
4452
  /*
4392
4453
  * Copyright (c) Microsoft Corporation. All rights reserved.
4393
4454
  * Licensed under the MIT License.
@@ -4451,7 +4512,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
4451
4512
  uiNotAllowed: uiNotAllowed
4452
4513
  });
4453
4514
 
4454
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4515
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4455
4516
 
4456
4517
  /*
4457
4518
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4482,12 +4543,11 @@ const InteractionRequiredAuthSubErrorMessage = [
4482
4543
  * Error thrown when user interaction is required.
4483
4544
  */
4484
4545
  class InteractionRequiredAuthError extends AuthError {
4485
- constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
4486
- super(errorCode, errorMessage, subError);
4546
+ constructor(errorCode, correlationId, errorMessage, subError, timestamp, traceId, claims, errorNo) {
4547
+ super(errorCode, correlationId, errorMessage, subError);
4487
4548
  Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
4488
4549
  this.timestamp = timestamp || "";
4489
4550
  this.traceId = traceId || "";
4490
- this.correlationId = correlationId || "";
4491
4551
  this.claims = claims || "";
4492
4552
  this.name = "InteractionRequiredAuthError";
4493
4553
  this.errorNo = errorNo;
@@ -4515,11 +4575,11 @@ function isInteractionRequiredError(errorCode, errorString, subError) {
4515
4575
  /**
4516
4576
  * Creates an InteractionRequiredAuthError
4517
4577
  */
4518
- function createInteractionRequiredAuthError(errorCode, errorMessage) {
4519
- return new InteractionRequiredAuthError(errorCode, errorMessage);
4578
+ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessage) {
4579
+ return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
4520
4580
  }
4521
4581
 
4522
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4582
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4523
4583
 
4524
4584
  /*
4525
4585
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4529,8 +4589,8 @@ function createInteractionRequiredAuthError(errorCode, errorMessage) {
4529
4589
  * Error thrown when there is an error with the server code, for example, unavailability.
4530
4590
  */
4531
4591
  class ServerError extends AuthError {
4532
- constructor(errorCode, errorMessage, subError, errorNo, status) {
4533
- super(errorCode, errorMessage, subError);
4592
+ constructor(errorCode, correlationId, errorMessage, subError, errorNo, status) {
4593
+ super(errorCode, correlationId, errorMessage, subError);
4534
4594
  this.name = "ServerError";
4535
4595
  this.errorNo = errorNo;
4536
4596
  this.status = status;
@@ -4538,18 +4598,19 @@ class ServerError extends AuthError {
4538
4598
  }
4539
4599
  }
4540
4600
 
4541
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4601
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4542
4602
  /**
4543
4603
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
4544
4604
  * @param base64Decode
4545
4605
  * @param state
4606
+ * @param correlationId
4546
4607
  */
4547
- function parseRequestState(base64Decode, state) {
4608
+ function parseRequestState(base64Decode, state, correlationId) {
4548
4609
  if (!base64Decode) {
4549
- throw createClientAuthError(noCryptoObject);
4610
+ throw createClientAuthError(noCryptoObject, correlationId);
4550
4611
  }
4551
4612
  if (!state) {
4552
- throw createClientAuthError(invalidState);
4613
+ throw createClientAuthError(invalidState, correlationId);
4553
4614
  }
4554
4615
  try {
4555
4616
  // Split the state between library state and user passed state and decode them separately
@@ -4566,11 +4627,11 @@ function parseRequestState(base64Decode, state) {
4566
4627
  };
4567
4628
  }
4568
4629
  catch (e) {
4569
- throw createClientAuthError(invalidState);
4630
+ throw createClientAuthError(invalidState, correlationId);
4570
4631
  }
4571
4632
  }
4572
4633
 
4573
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4634
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4574
4635
 
4575
4636
  /*
4576
4637
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4605,7 +4666,7 @@ class ResponseHandler {
4605
4666
  const serverErrorNo = serverResponse.error_codes?.length
4606
4667
  ? serverResponse.error_codes[0]
4607
4668
  : undefined;
4608
- const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
4669
+ const serverError = new ServerError(serverResponse.error || "", serverResponse.correlation_id || "", errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
4609
4670
  // check if 500 error
4610
4671
  if (refreshAccessToken &&
4611
4672
  serverResponse.status &&
@@ -4627,7 +4688,7 @@ class ResponseHandler {
4627
4688
  return;
4628
4689
  }
4629
4690
  if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
4630
- throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
4691
+ throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.correlation_id || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.claims || "", serverErrorNo);
4631
4692
  }
4632
4693
  throw serverError;
4633
4694
  }
@@ -4637,24 +4698,16 @@ class ResponseHandler {
4637
4698
  * @param serverTokenResponse
4638
4699
  * @param authority
4639
4700
  */
4640
- async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, apiId, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
4701
+ async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, apiId, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId, additionalCacheKeyComponents) {
4641
4702
  // create an idToken object (not entity)
4642
4703
  let idTokenClaims;
4643
4704
  if (serverTokenResponse.id_token) {
4644
- idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode);
4705
+ idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode, request.correlationId);
4645
4706
  // token nonce check (TODO: Add a warning if no nonce is given?)
4646
4707
  if (authCodePayload && authCodePayload.nonce) {
4647
4708
  if (idTokenClaims.nonce !== authCodePayload.nonce) {
4648
- throw createClientAuthError(nonceMismatch);
4649
- }
4650
- }
4651
- // token max_age check
4652
- if (request.maxAge || request.maxAge === 0) {
4653
- const authTime = idTokenClaims.auth_time;
4654
- if (!authTime) {
4655
- throw createClientAuthError(authTimeNotFound);
4709
+ throw createClientAuthError(nonceMismatch, request.correlationId);
4656
4710
  }
4657
- checkMaxAge(authTime, request.maxAge);
4658
4711
  }
4659
4712
  }
4660
4713
  // generate homeAccountId
@@ -4662,12 +4715,12 @@ class ResponseHandler {
4662
4715
  // save the response tokens
4663
4716
  let requestStateObj;
4664
4717
  if (!!authCodePayload && !!authCodePayload.state) {
4665
- requestStateObj = parseRequestState(this.cryptoObj.base64Decode, authCodePayload.state);
4718
+ requestStateObj = parseRequestState(this.cryptoObj.base64Decode, authCodePayload.state, request.correlationId);
4666
4719
  }
4667
4720
  // Add keyId from request to serverTokenResponse if defined
4668
4721
  serverTokenResponse.key_id =
4669
4722
  serverTokenResponse.key_id || request.sshKid || undefined;
4670
- const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload);
4723
+ const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents);
4671
4724
  let cacheContext;
4672
4725
  try {
4673
4726
  if (this.persistencePlugin && this.serializableCache) {
@@ -4714,10 +4767,10 @@ class ResponseHandler {
4714
4767
  * @param idTokenObj
4715
4768
  * @param authority
4716
4769
  */
4717
- generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload) {
4770
+ generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents) {
4718
4771
  const env = authority.getPreferredCache();
4719
4772
  if (!env) {
4720
- throw createClientAuthError(invalidCacheEnvironment);
4773
+ throw createClientAuthError(invalidCacheEnvironment, request.correlationId);
4721
4774
  }
4722
4775
  const claimsTenantId = getTenantIdFromIdTokenClaims(idTokenClaims);
4723
4776
  // IdToken: non AAD scenarios can have empty realm
@@ -4733,8 +4786,8 @@ class ResponseHandler {
4733
4786
  if (serverTokenResponse.access_token) {
4734
4787
  // If scopes not returned in server response, use request scopes
4735
4788
  const responseScopes = serverTokenResponse.scope
4736
- ? ScopeSet.fromString(serverTokenResponse.scope)
4737
- : new ScopeSet(request.scopes || []);
4789
+ ? ScopeSet.fromString(serverTokenResponse.scope, request.correlationId)
4790
+ : new ScopeSet(request.scopes || [], request.correlationId);
4738
4791
  /*
4739
4792
  * Use timestamp calculated before request
4740
4793
  * Server may return timestamps as strings, parse to numbers if so.
@@ -4754,7 +4807,7 @@ class ResponseHandler {
4754
4807
  ? reqTimestamp + refreshIn
4755
4808
  : undefined;
4756
4809
  // non AAD scenarios can have empty realm
4757
- cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id);
4810
+ cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, request.correlationId, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, additionalCacheKeyComponents);
4758
4811
  // Set resource (to be used for MCP scenarios)
4759
4812
  const resource = request.resource || null;
4760
4813
  if (resource) {
@@ -4820,14 +4873,14 @@ class ResponseHandler {
4820
4873
  const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
4821
4874
  const { secret, keyId } = cacheRecord.accessToken;
4822
4875
  if (!keyId) {
4823
- throw createClientAuthError(keyIdMissing);
4876
+ throw createClientAuthError(keyIdMissing, request.correlationId);
4824
4877
  }
4825
4878
  accessToken = await popTokenGenerator.signPopToken(secret, keyId, request);
4826
4879
  }
4827
4880
  else {
4828
4881
  accessToken = cacheRecord.accessToken.secret;
4829
4882
  }
4830
- responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
4883
+ responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target, request.correlationId).asArray();
4831
4884
  // Access token expiresOn cached in seconds, converting to Date for AuthenticationResult
4832
4885
  expiresOn = toDateFromSeconds(cacheRecord.accessToken.expiresOn);
4833
4886
  extExpiresOn = toDateFromSeconds(cacheRecord.accessToken.extendedExpiresOn);
@@ -4845,8 +4898,18 @@ class ResponseHandler {
4845
4898
  const tid = idTokenClaims?.tid || "";
4846
4899
  // for hybrid + native bridge enablement, send back the native account Id
4847
4900
  if (serverTokenResponse?.spa_accountid && !!cacheRecord.account) {
4901
+ // Set on deprecated top-level for downgrade compat
4848
4902
  cacheRecord.account.nativeAccountId =
4849
4903
  serverTokenResponse?.spa_accountid;
4904
+ // Set on the matching tenant profile (source of truth)
4905
+ const targetTenantId = tid || cacheRecord.account.realm;
4906
+ if (cacheRecord.account.tenantProfiles) {
4907
+ const matchingProfile = cacheRecord.account.tenantProfiles.find((tp) => tp.tenantId === targetTenantId);
4908
+ if (matchingProfile) {
4909
+ matchingProfile.nativeAccountId =
4910
+ serverTokenResponse.spa_accountid;
4911
+ }
4912
+ }
4850
4913
  }
4851
4914
  const accountInfo = cacheRecord.account
4852
4915
  ? updateAccountTenantProfileData(getAccountInfo(cacheRecord.account), undefined, // tenantProfile optional
@@ -4877,6 +4940,7 @@ class ResponseHandler {
4877
4940
  };
4878
4941
  }
4879
4942
  }
4943
+ /** @internal */
4880
4944
  function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, correlationId, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger, performanceClient) {
4881
4945
  logger?.verbose("setCachedAccount called", correlationId);
4882
4946
  /*
@@ -4904,21 +4968,21 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
4904
4968
  cloudGraphHostName: authCodePayload?.cloud_graph_host_name,
4905
4969
  msGraphHost: authCodePayload?.msgraph_host,
4906
4970
  nativeAccountId: nativeAccountId,
4907
- }, authority, base64Decode);
4971
+ }, authority, correlationId, base64Decode);
4908
4972
  const tenantProfiles = baseAccount.tenantProfiles || [];
4909
4973
  const tenantId = claimsTenantId || baseAccount.realm;
4910
4974
  if (tenantId &&
4911
4975
  !tenantProfiles.find((tenantProfile) => {
4912
4976
  return tenantProfile.tenantId === tenantId;
4913
4977
  })) {
4914
- const newTenantProfile = buildTenantProfile(homeAccountId, baseAccount.localAccountId, tenantId, idTokenClaims);
4978
+ const newTenantProfile = buildTenantProfile(homeAccountId, baseAccount.localAccountId, tenantId, nativeAccountId, idTokenClaims);
4915
4979
  tenantProfiles.push(newTenantProfile);
4916
4980
  }
4917
4981
  baseAccount.tenantProfiles = tenantProfiles;
4918
4982
  return baseAccount;
4919
4983
  }
4920
4984
 
4921
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4985
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4922
4986
  /*
4923
4987
  * Copyright (c) Microsoft Corporation. All rights reserved.
4924
4988
  * Licensed under the MIT License.
@@ -4928,12 +4992,12 @@ const CcsCredentialType = {
4928
4992
  UPN: "UPN",
4929
4993
  };
4930
4994
 
4931
- /*! @azure/msal-common v16.8.0 2026-06-10 */
4995
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4932
4996
  /*
4933
4997
  * Copyright (c) Microsoft Corporation. All rights reserved.
4934
4998
  * Licensed under the MIT License.
4935
4999
  */
4936
- async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
5000
+ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiPath) {
4937
5001
  if (typeof clientAssertion === "string") {
4938
5002
  return clientAssertion;
4939
5003
  }
@@ -4941,12 +5005,13 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
4941
5005
  const config = {
4942
5006
  clientId: clientId,
4943
5007
  tokenEndpoint: tokenEndpoint,
5008
+ fmiPath: fmiPath,
4944
5009
  };
4945
5010
  return clientAssertion(config);
4946
5011
  }
4947
5012
  }
4948
5013
 
4949
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5014
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4950
5015
  /*
4951
5016
  * Copyright (c) Microsoft Corporation. All rights reserved.
4952
5017
  * Licensed under the MIT License.
@@ -4967,7 +5032,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
4967
5032
  };
4968
5033
  }
4969
5034
 
4970
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5035
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
4971
5036
 
4972
5037
  /*
4973
5038
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4995,7 +5060,7 @@ class ThrottlingUtils {
4995
5060
  cacheManager.removeItem(key, correlationId);
4996
5061
  return;
4997
5062
  }
4998
- throw new ServerError(value.errorCodes?.join(" ") || "", value.errorMessage, value.subError);
5063
+ throw new ServerError(value.errorCodes?.join(" ") || "", correlationId, value.errorMessage, value.subError);
4999
5064
  }
5000
5065
  }
5001
5066
  /**
@@ -5053,7 +5118,7 @@ class ThrottlingUtils {
5053
5118
  }
5054
5119
  }
5055
5120
 
5056
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5121
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5057
5122
 
5058
5123
  /*
5059
5124
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5064,7 +5129,7 @@ class ThrottlingUtils {
5064
5129
  */
5065
5130
  class NetworkError extends AuthError {
5066
5131
  constructor(error, httpStatus, responseHeaders) {
5067
- super(error.errorCode, error.errorMessage, error.subError);
5132
+ super(error.errorCode, error.correlationId, error.errorMessage, error.subError);
5068
5133
  Object.setPrototypeOf(this, NetworkError.prototype);
5069
5134
  this.name = "NetworkError";
5070
5135
  this.error = error;
@@ -5084,7 +5149,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
5084
5149
  return new NetworkError(error, httpStatus, responseHeaders);
5085
5150
  }
5086
5151
 
5087
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5152
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5088
5153
 
5089
5154
  /*
5090
5155
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5136,6 +5201,7 @@ function createTokenQueryParameters(request, clientId, redirectUri, performanceC
5136
5201
  * @param queryString
5137
5202
  * @param headers
5138
5203
  * @param thumbprint
5204
+ * @internal
5139
5205
  */
5140
5206
  async function executePostToTokenEndpoint(tokenEndpoint, queryString, headers, thumbprint, correlationId, cacheManager, networkClient, logger, performanceClient, serverTelemetryManager) {
5141
5207
  const response = await sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers }, correlationId, cacheManager, networkClient, logger, performanceClient);
@@ -5157,6 +5223,7 @@ async function executePostToTokenEndpoint(tokenEndpoint, queryString, headers, t
5157
5223
  * @param networkClient - Network module instance
5158
5224
  * @param logger - Logger instance
5159
5225
  * @param performanceClient - Performance client instance
5226
+ * @internal
5160
5227
  */
5161
5228
  async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId, cacheManager, networkClient, logger, performanceClient) {
5162
5229
  ThrottlingUtils.preProcess(cacheManager, thumbprint, correlationId);
@@ -5191,14 +5258,14 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
5191
5258
  throw e;
5192
5259
  }
5193
5260
  else {
5194
- throw createClientAuthError(networkError);
5261
+ throw createClientAuthError(networkError, correlationId);
5195
5262
  }
5196
5263
  }
5197
5264
  ThrottlingUtils.postProcess(cacheManager, thumbprint, response, correlationId);
5198
5265
  return response;
5199
5266
  }
5200
5267
 
5201
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5268
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5202
5269
  /*
5203
5270
  * Copyright (c) Microsoft Corporation. All rights reserved.
5204
5271
  * Licensed under the MIT License.
@@ -5210,7 +5277,7 @@ function isOpenIdConfigResponse(response) {
5210
5277
  response.hasOwnProperty("jwks_uri"));
5211
5278
  }
5212
5279
 
5213
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5280
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5214
5281
  /*
5215
5282
  * Copyright (c) Microsoft Corporation. All rights reserved.
5216
5283
  * Licensed under the MIT License.
@@ -5220,7 +5287,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5220
5287
  response.hasOwnProperty("metadata"));
5221
5288
  }
5222
5289
 
5223
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5290
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5224
5291
  /*
5225
5292
  * Copyright (c) Microsoft Corporation. All rights reserved.
5226
5293
  * Licensed under the MIT License.
@@ -5230,7 +5297,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
5230
5297
  response.hasOwnProperty("error_description"));
5231
5298
  }
5232
5299
 
5233
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5300
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5234
5301
 
5235
5302
  /*
5236
5303
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5257,9 +5324,12 @@ class RegionDiscovery {
5257
5324
  try {
5258
5325
  const localIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(IMDS_VERSION, options);
5259
5326
  if (localIMDSVersionResponse.status === HTTP_SUCCESS) {
5260
- autodetectedRegionName = localIMDSVersionResponse.body;
5261
- regionDiscoveryMetadata.region_source =
5262
- RegionDiscoverySources.IMDS;
5327
+ autodetectedRegionName =
5328
+ localIMDSVersionResponse.body?.location;
5329
+ if (autodetectedRegionName) {
5330
+ regionDiscoveryMetadata.region_source =
5331
+ RegionDiscoverySources.IMDS;
5332
+ }
5263
5333
  }
5264
5334
  // If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
5265
5335
  if (localIMDSVersionResponse.status ===
@@ -5274,9 +5344,11 @@ class RegionDiscovery {
5274
5344
  if (currentIMDSVersionResponse.status ===
5275
5345
  HTTP_SUCCESS) {
5276
5346
  autodetectedRegionName =
5277
- currentIMDSVersionResponse.body;
5278
- regionDiscoveryMetadata.region_source =
5279
- RegionDiscoverySources.IMDS;
5347
+ currentIMDSVersionResponse.body?.location;
5348
+ if (autodetectedRegionName) {
5349
+ regionDiscoveryMetadata.region_source =
5350
+ RegionDiscoverySources.IMDS;
5351
+ }
5280
5352
  }
5281
5353
  }
5282
5354
  }
@@ -5300,11 +5372,12 @@ class RegionDiscovery {
5300
5372
  /**
5301
5373
  * Make the call to the IMDS endpoint
5302
5374
  *
5303
- * @param imdsEndpointUrl
5304
- * @returns Promise<NetworkResponse<string>>
5375
+ * @param version
5376
+ * @param options
5377
+ * @returns Promise<NetworkResponse<ImdsComputeResponse>>
5305
5378
  */
5306
5379
  async getRegionFromIMDS(version, options) {
5307
- return this.networkInterface.sendGetRequestAsync(`${IMDS_ENDPOINT}?api-version=${version}&format=text`, options, IMDS_TIMEOUT);
5380
+ return this.networkInterface.sendGetRequestAsync(`${IMDS_ENDPOINT}?api-version=${version}`, options, IMDS_TIMEOUT);
5308
5381
  }
5309
5382
  /**
5310
5383
  * Get the most recent version of the IMDS endpoint available
@@ -5335,7 +5408,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5335
5408
  },
5336
5409
  };
5337
5410
 
5338
- /*! @azure/msal-common v16.8.0 2026-06-10 */
5411
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
5339
5412
 
5340
5413
  /*
5341
5414
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5365,7 +5438,7 @@ class Authority {
5365
5438
  this.regionDiscovery = new RegionDiscovery(networkInterface, this.logger, this.performanceClient, this.correlationId);
5366
5439
  }
5367
5440
  /**
5368
- * Get {@link AuthorityType}
5441
+ * Get {@link AuthorityType:type}
5369
5442
  * @param authorityUri {@link IUri}
5370
5443
  * @private
5371
5444
  */
@@ -5411,7 +5484,7 @@ class Authority {
5411
5484
  * Sets canonical authority.
5412
5485
  */
5413
5486
  set canonicalAuthority(url) {
5414
- this._canonicalAuthority = new UrlString(url);
5487
+ this._canonicalAuthority = new UrlString(url, this.correlationId);
5415
5488
  this._canonicalAuthority.validateAsUri();
5416
5489
  this._canonicalAuthorityUrlComponents = null;
5417
5490
  }
@@ -5445,7 +5518,7 @@ class Authority {
5445
5518
  return this.replacePath(this.metadata.authorization_endpoint);
5446
5519
  }
5447
5520
  else {
5448
- throw createClientAuthError(endpointResolutionError);
5521
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5449
5522
  }
5450
5523
  }
5451
5524
  /**
@@ -5456,7 +5529,7 @@ class Authority {
5456
5529
  return this.replacePath(this.metadata.token_endpoint);
5457
5530
  }
5458
5531
  else {
5459
- throw createClientAuthError(endpointResolutionError);
5532
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5460
5533
  }
5461
5534
  }
5462
5535
  get deviceCodeEndpoint() {
@@ -5464,7 +5537,7 @@ class Authority {
5464
5537
  return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
5465
5538
  }
5466
5539
  else {
5467
- throw createClientAuthError(endpointResolutionError);
5540
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5468
5541
  }
5469
5542
  }
5470
5543
  /**
@@ -5474,12 +5547,12 @@ class Authority {
5474
5547
  if (this.discoveryComplete()) {
5475
5548
  // ROPC policies may not have end_session_endpoint set
5476
5549
  if (!this.metadata.end_session_endpoint) {
5477
- throw createClientAuthError(endSessionEndpointNotSupported);
5550
+ throw createClientAuthError(endSessionEndpointNotSupported, this.correlationId);
5478
5551
  }
5479
5552
  return this.replacePath(this.metadata.end_session_endpoint);
5480
5553
  }
5481
5554
  else {
5482
- throw createClientAuthError(endpointResolutionError);
5555
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5483
5556
  }
5484
5557
  }
5485
5558
  /**
@@ -5490,7 +5563,7 @@ class Authority {
5490
5563
  return this.replacePath(this.metadata.issuer);
5491
5564
  }
5492
5565
  else {
5493
- throw createClientAuthError(endpointResolutionError);
5566
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5494
5567
  }
5495
5568
  }
5496
5569
  /**
@@ -5501,7 +5574,7 @@ class Authority {
5501
5574
  return this.replacePath(this.metadata.jwks_uri);
5502
5575
  }
5503
5576
  else {
5504
- throw createClientAuthError(endpointResolutionError);
5577
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
5505
5578
  }
5506
5579
  }
5507
5580
  /**
@@ -5528,7 +5601,7 @@ class Authority {
5528
5601
  */
5529
5602
  replacePath(urlString) {
5530
5603
  let endpoint = urlString;
5531
- const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
5604
+ const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority, this.correlationId);
5532
5605
  const cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
5533
5606
  const cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
5534
5607
  const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
@@ -5536,7 +5609,7 @@ class Authority {
5536
5609
  let cachedPart = cachedAuthorityParts[index];
5537
5610
  if (index === 0 &&
5538
5611
  this.canReplaceTenant(cachedAuthorityUrlComponents)) {
5539
- const tenantId = new UrlString(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];
5612
+ const tenantId = new UrlString(this.metadata.authorization_endpoint, this.correlationId).getUrlComponents().PathSegments[0];
5540
5613
  /**
5541
5614
  * Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
5542
5615
  * by comparing its first path segment to the corresponding authorization endpoint path segment, which is
@@ -5670,7 +5743,7 @@ class Authority {
5670
5743
  }
5671
5744
  else {
5672
5745
  // Metadata could not be obtained from the config, cache, network or hardcoded values
5673
- throw createClientAuthError(openIdConfigError, this.defaultOpenIdConfigurationEndpoint);
5746
+ throw createClientAuthError(openIdConfigError, this.defaultOpenIdConfigurationEndpoint, this.correlationId);
5674
5747
  }
5675
5748
  }
5676
5749
  /**
@@ -5722,7 +5795,7 @@ class Authority {
5722
5795
  * @param metadataEntity
5723
5796
  */
5724
5797
  isAuthoritySameType(metadataEntity) {
5725
- const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);
5798
+ const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority, this.correlationId);
5726
5799
  const cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
5727
5800
  return (cachedParts.length ===
5728
5801
  this.canonicalAuthorityUrlComponents.PathSegments.length);
@@ -5736,7 +5809,7 @@ class Authority {
5736
5809
  return JSON.parse(this.authorityOptions.authorityMetadata);
5737
5810
  }
5738
5811
  catch (e) {
5739
- throw createClientConfigurationError(invalidAuthorityMetadata);
5812
+ throw createClientConfigurationError(invalidAuthorityMetadata, this.correlationId);
5740
5813
  }
5741
5814
  }
5742
5815
  return null;
@@ -5792,7 +5865,7 @@ class Authority {
5792
5865
  RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
5793
5866
  this.regionDiscoveryMetadata.region_used =
5794
5867
  userConfiguredAzureRegion;
5795
- return Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion);
5868
+ return Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion, this.correlationId);
5796
5869
  }
5797
5870
  const autodetectedRegionName = await invokeAsync(this.regionDiscovery.detectRegion.bind(this.regionDiscovery), RegionDiscoveryDetectRegion, this.logger, this.performanceClient, this.correlationId)(this.authorityOptions.azureRegionConfiguration
5798
5871
  ?.environmentRegion, this.regionDiscoveryMetadata);
@@ -5801,7 +5874,7 @@ class Authority {
5801
5874
  RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
5802
5875
  this.regionDiscoveryMetadata.region_used =
5803
5876
  autodetectedRegionName;
5804
- return Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName);
5877
+ return Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName, this.correlationId);
5805
5878
  }
5806
5879
  this.regionDiscoveryMetadata.region_outcome =
5807
5880
  RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
@@ -5826,7 +5899,7 @@ class Authority {
5826
5899
  return AuthorityMetadataSource.NETWORK;
5827
5900
  }
5828
5901
  // Metadata could not be obtained from the config, cache, network or hardcoded values
5829
- throw createClientConfigurationError(untrustedAuthority);
5902
+ throw createClientConfigurationError(untrustedAuthority, this.correlationId);
5830
5903
  }
5831
5904
  updateCloudDiscoveryMetadataFromLocalSources(metadataEntity) {
5832
5905
  this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration", this.correlationId);
@@ -5890,7 +5963,7 @@ class Authority {
5890
5963
  }
5891
5964
  catch (e) {
5892
5965
  this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.", this.correlationId);
5893
- throw createClientConfigurationError(invalidCloudDiscoveryMetadata);
5966
+ throw createClientConfigurationError(invalidCloudDiscoveryMetadata, this.correlationId);
5894
5967
  }
5895
5968
  }
5896
5969
  // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities
@@ -5968,8 +6041,7 @@ class Authority {
5968
6041
  const normalizedHost = host.toLowerCase();
5969
6042
  const matches = this.authorityOptions.knownAuthorities.filter((authority) => {
5970
6043
  return (authority &&
5971
- UrlString.getDomainFromUrl(authority).toLowerCase() ===
5972
- normalizedHost);
6044
+ UrlString.getDomainFromUrl(authority, this.correlationId).toLowerCase() === normalizedHost);
5973
6045
  });
5974
6046
  return matches.length > 0;
5975
6047
  }
@@ -6013,7 +6085,7 @@ class Authority {
6013
6085
  return this.metadata.preferred_cache;
6014
6086
  }
6015
6087
  else {
6016
- throw createClientAuthError(endpointResolutionError);
6088
+ throw createClientAuthError(endpointResolutionError, this.correlationId);
6017
6089
  }
6018
6090
  }
6019
6091
  /**
@@ -6056,7 +6128,7 @@ class Authority {
6056
6128
  */
6057
6129
  validateIssuer(issuer) {
6058
6130
  if (!issuer) {
6059
- throw createClientConfigurationError(issuerValidationFailed);
6131
+ throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
6060
6132
  }
6061
6133
  // Parse with the WHATWG URL API. URL normalizes scheme + host to lowercase per RFC 3986.
6062
6134
  let issuerUrl;
@@ -6064,7 +6136,7 @@ class Authority {
6064
6136
  issuerUrl = new URL(issuer);
6065
6137
  }
6066
6138
  catch {
6067
- throw createClientConfigurationError(issuerValidationFailed);
6139
+ throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
6068
6140
  }
6069
6141
  const issuerScheme = issuerUrl.protocol;
6070
6142
  const issuerHost = issuerUrl.host;
@@ -6102,7 +6174,7 @@ class Authority {
6102
6174
  return;
6103
6175
  }
6104
6176
  // issuer validation fails if none of the above rules are satisfied
6105
- throw createClientConfigurationError(issuerValidationFailed);
6177
+ throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
6106
6178
  }
6107
6179
  /**
6108
6180
  * Rule 1: The issuer scheme + host (and port) match the authority's. Path
@@ -6190,9 +6262,9 @@ class Authority {
6190
6262
  * @param host string
6191
6263
  * @param region string
6192
6264
  */
6193
- static buildRegionalAuthorityString(host, region, queryString) {
6265
+ static buildRegionalAuthorityString(host, region, correlationId, queryString) {
6194
6266
  // Create and validate a Url string object with the initial authority string
6195
- const authorityUrlInstance = new UrlString(host);
6267
+ const authorityUrlInstance = new UrlString(host, correlationId);
6196
6268
  authorityUrlInstance.validateAsUri();
6197
6269
  const authorityUrlParts = authorityUrlInstance.getUrlComponents();
6198
6270
  let hostNameAndPort = `${region}.${authorityUrlParts.HostNameAndPort}`;
@@ -6203,7 +6275,7 @@ class Authority {
6203
6275
  const url = UrlString.constructAuthorityUriFromObject({
6204
6276
  ...authorityUrlInstance.getUrlComponents(),
6205
6277
  HostNameAndPort: hostNameAndPort,
6206
- }).urlString;
6278
+ }, correlationId).urlString;
6207
6279
  // Add the query string if a query string was provided
6208
6280
  if (queryString)
6209
6281
  return `${url}?${queryString}`;
@@ -6215,15 +6287,15 @@ class Authority {
6215
6287
  * @param metadata OpenIdConfigResponse
6216
6288
  * @param azureRegion string
6217
6289
  */
6218
- static replaceWithRegionalInformation(metadata, azureRegion) {
6290
+ static replaceWithRegionalInformation(metadata, azureRegion, correlationId) {
6219
6291
  const regionalMetadata = { ...metadata };
6220
6292
  regionalMetadata.authorization_endpoint =
6221
- Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion);
6293
+ Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion, correlationId);
6222
6294
  regionalMetadata.token_endpoint =
6223
- Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion);
6295
+ Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion, correlationId);
6224
6296
  if (regionalMetadata.end_session_endpoint) {
6225
6297
  regionalMetadata.end_session_endpoint =
6226
- Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion);
6298
+ Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion, correlationId);
6227
6299
  }
6228
6300
  return regionalMetadata;
6229
6301
  }
@@ -6236,9 +6308,9 @@ class Authority {
6236
6308
  *
6237
6309
  * @param authority
6238
6310
  */
6239
- static transformCIAMAuthority(authority) {
6311
+ static transformCIAMAuthority(authority, correlationId) {
6240
6312
  let ciamAuthority = authority;
6241
- const authorityUrl = new UrlString(authority);
6313
+ const authorityUrl = new UrlString(authority, correlationId);
6242
6314
  const authorityUrlComponents = authorityUrl.getUrlComponents();
6243
6315
  // check if transformation is needed
6244
6316
  if (authorityUrlComponents.PathSegments.length === 0 &&
@@ -6260,8 +6332,8 @@ Authority.reservedTenantDomains = new Set([
6260
6332
  /**
6261
6333
  * Extract tenantId from authority
6262
6334
  */
6263
- function getTenantFromAuthorityString(authority) {
6264
- const authorityUrl = new UrlString(authority);
6335
+ function getTenantFromAuthorityString(authority, correlationId) {
6336
+ const authorityUrl = new UrlString(authority, correlationId);
6265
6337
  const authorityUrlComponents = authorityUrl.getUrlComponents();
6266
6338
  /**
6267
6339
  * For credential matching purposes, tenantId is the last path segment of the authority URL:
@@ -6294,7 +6366,7 @@ function buildStaticAuthorityOptions(authOptions) {
6294
6366
  cloudDiscoveryMetadata = JSON.parse(rawCloudDiscoveryMetadata);
6295
6367
  }
6296
6368
  catch (e) {
6297
- throw createClientConfigurationError(invalidCloudDiscoveryMetadata);
6369
+ throw createClientConfigurationError(invalidCloudDiscoveryMetadata, "");
6298
6370
  }
6299
6371
  }
6300
6372
  return {
@@ -6306,7 +6378,7 @@ function buildStaticAuthorityOptions(authOptions) {
6306
6378
  };
6307
6379
  }
6308
6380
 
6309
- /*! @azure/msal-common v16.8.0 2026-06-10 */
6381
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
6310
6382
 
6311
6383
  /*
6312
6384
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6328,7 +6400,7 @@ function buildStaticAuthorityOptions(authOptions) {
6328
6400
  * @internal
6329
6401
  */
6330
6402
  async function createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
6331
- const authorityUriFinal = Authority.transformCIAMAuthority(formatAuthorityUri(authorityUri));
6403
+ const authorityUriFinal = Authority.transformCIAMAuthority(formatAuthorityUri(authorityUri), correlationId);
6332
6404
  // Initialize authority and perform discovery endpoint check.
6333
6405
  const acquireTokenAuthority = new Authority(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, correlationId, performanceClient);
6334
6406
  try {
@@ -6336,11 +6408,11 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6336
6408
  return acquireTokenAuthority;
6337
6409
  }
6338
6410
  catch (e) {
6339
- throw createClientAuthError(endpointResolutionError);
6411
+ throw createClientAuthError(endpointResolutionError, correlationId);
6340
6412
  }
6341
6413
  }
6342
6414
 
6343
- /*! @azure/msal-common v16.8.0 2026-06-10 */
6415
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
6344
6416
 
6345
6417
  /*
6346
6418
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6380,7 +6452,7 @@ class AuthorizationCodeClient {
6380
6452
  */
6381
6453
  async acquireToken(request, apiId, authCodePayload) {
6382
6454
  if (!request.code) {
6383
- throw createClientAuthError(requestCannotBeMade);
6455
+ throw createClientAuthError(requestCannotBeMade, request.correlationId);
6384
6456
  }
6385
6457
  // Check for new cloud instance
6386
6458
  if (authCodePayload && authCodePayload.cloud_instance_host_name) {
@@ -6403,7 +6475,7 @@ class AuthorizationCodeClient {
6403
6475
  getLogoutUri(logoutRequest) {
6404
6476
  // Throw error if logoutRequest is null/undefined
6405
6477
  if (!logoutRequest) {
6406
- throw createClientConfigurationError(logoutRequestEmpty);
6478
+ throw createClientConfigurationError(logoutRequestEmpty, "");
6407
6479
  }
6408
6480
  const queryString = this.createLogoutUrlQueryString(logoutRequest);
6409
6481
  // Construct logout URI
@@ -6451,7 +6523,7 @@ class AuthorizationCodeClient {
6451
6523
  if (!this.includeRedirectUri) {
6452
6524
  // Just validate
6453
6525
  if (!request.redirectUri) {
6454
- throw createClientConfigurationError(redirectUriEmpty);
6526
+ throw createClientConfigurationError(redirectUriEmpty, request.correlationId);
6455
6527
  }
6456
6528
  }
6457
6529
  else {
@@ -6459,7 +6531,7 @@ class AuthorizationCodeClient {
6459
6531
  addRedirectUri(parameters, request.redirectUri);
6460
6532
  }
6461
6533
  // Add scope array, parameter builder will add default scopes and dedupe
6462
- addScopes(parameters, request.scopes, true, this.oidcDefaultScopes);
6534
+ addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
6463
6535
  addResource(parameters, request.resource);
6464
6536
  // add code: user set, not validated
6465
6537
  addAuthorizationCode(parameters, request.code);
@@ -6502,7 +6574,7 @@ class AuthorizationCodeClient {
6502
6574
  addSshJwk(parameters, request.sshJwk);
6503
6575
  }
6504
6576
  else {
6505
- throw createClientConfigurationError(missingSshJwk);
6577
+ throw createClientConfigurationError(missingSshJwk, request.correlationId);
6506
6578
  }
6507
6579
  }
6508
6580
  let ccsCred = undefined;
@@ -6553,7 +6625,7 @@ class AuthorizationCodeClient {
6553
6625
  });
6554
6626
  }
6555
6627
  instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
6556
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
6628
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
6557
6629
  return mapToQueryString(parameters);
6558
6630
  }
6559
6631
  /**
@@ -6597,7 +6669,7 @@ class AuthorizationCodeClient {
6597
6669
  }
6598
6670
  }
6599
6671
 
6600
- /*! @azure/msal-common v16.8.0 2026-06-10 */
6672
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
6601
6673
 
6602
6674
  /*
6603
6675
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6643,11 +6715,11 @@ class RefreshTokenClient {
6643
6715
  async acquireTokenByRefreshToken(request, apiId) {
6644
6716
  // Cannot renew token if no request object is given.
6645
6717
  if (!request) {
6646
- throw createClientConfigurationError(tokenRequestEmpty);
6718
+ throw createClientConfigurationError(tokenRequestEmpty, "");
6647
6719
  }
6648
6720
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
6649
6721
  if (!request.account) {
6650
- throw createClientAuthError(noAccountInSilentRequest);
6722
+ throw createClientAuthError(noAccountInSilentRequest, request.correlationId);
6651
6723
  }
6652
6724
  // try checking if FOCI is enabled for the given application
6653
6725
  const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, request.correlationId);
@@ -6684,7 +6756,7 @@ class RefreshTokenClient {
6684
6756
  // fetches family RT or application RT based on FOCI value
6685
6757
  const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, request.correlationId, undefined);
6686
6758
  if (!refreshToken) {
6687
- throw createInteractionRequiredAuthError(noTokensFound);
6759
+ throw createInteractionRequiredAuthError(noTokensFound, request.correlationId);
6688
6760
  }
6689
6761
  if (refreshToken.expiresOn) {
6690
6762
  const offset = request.refreshTokenExpirationOffsetSeconds ||
@@ -6694,7 +6766,7 @@ class RefreshTokenClient {
6694
6766
  rtOffsetSeconds: offset,
6695
6767
  }, request.correlationId);
6696
6768
  if (isTokenExpired(refreshToken.expiresOn, offset)) {
6697
- throw createInteractionRequiredAuthError(refreshTokenExpired);
6769
+ throw createInteractionRequiredAuthError(refreshTokenExpired, request.correlationId);
6698
6770
  }
6699
6771
  }
6700
6772
  // attach cached RT size to the current measurement
@@ -6748,7 +6820,7 @@ class RefreshTokenClient {
6748
6820
  if (request.redirectUri) {
6749
6821
  addRedirectUri(parameters, request.redirectUri);
6750
6822
  }
6751
- addScopes(parameters, request.scopes, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
6823
+ addScopes(parameters, request.scopes, request.correlationId, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
6752
6824
  addGrantType(parameters, GrantType.REFRESH_TOKEN_GRANT);
6753
6825
  addClientInfo(parameters);
6754
6826
  addLibraryInfo(parameters, this.config.libraryInfo);
@@ -6784,7 +6856,7 @@ class RefreshTokenClient {
6784
6856
  addSshJwk(parameters, request.sshJwk);
6785
6857
  }
6786
6858
  else {
6787
- throw createClientConfigurationError(missingSshJwk);
6859
+ throw createClientConfigurationError(missingSshJwk, request.correlationId);
6788
6860
  }
6789
6861
  }
6790
6862
  if (this.config.systemOptions.preventCorsPreflight &&
@@ -6813,12 +6885,12 @@ class RefreshTokenClient {
6813
6885
  });
6814
6886
  }
6815
6887
  instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
6816
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
6888
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
6817
6889
  return mapToQueryString(parameters);
6818
6890
  }
6819
6891
  }
6820
6892
 
6821
- /*! @azure/msal-common v16.8.0 2026-06-10 */
6893
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
6822
6894
 
6823
6895
  /*
6824
6896
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6853,32 +6925,32 @@ class SilentFlowClient {
6853
6925
  if (request.forceRefresh || !StringUtils.isEmptyObj(request.claims)) {
6854
6926
  // Must refresh due to present force_refresh flag.
6855
6927
  this.setCacheOutcome(CacheOutcome.FORCE_REFRESH_OR_CLAIMS, request.correlationId);
6856
- throw createClientAuthError(tokenRefreshRequired);
6928
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
6857
6929
  }
6858
6930
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
6859
6931
  if (!request.account) {
6860
- throw createClientAuthError(noAccountInSilentRequest);
6932
+ throw createClientAuthError(noAccountInSilentRequest, request.correlationId);
6861
6933
  }
6862
6934
  const requestTenantId = request.account.tenantId ||
6863
- getTenantFromAuthorityString(request.authority);
6935
+ getTenantFromAuthorityString(request.authority, request.correlationId);
6864
6936
  const tokenKeys = this.cacheManager.getTokenKeys();
6865
6937
  const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId);
6866
6938
  if (!cachedAccessToken) {
6867
6939
  // must refresh due to non-existent access_token
6868
6940
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
6869
- throw createClientAuthError(tokenRefreshRequired);
6941
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
6870
6942
  }
6871
6943
  else if (wasClockTurnedBack(cachedAccessToken.cachedAt) ||
6872
6944
  isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
6873
6945
  // must refresh due to the expires_in value
6874
6946
  this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);
6875
- throw createClientAuthError(tokenRefreshRequired);
6947
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
6876
6948
  }
6877
6949
  else if (request.resource) {
6878
6950
  // cached access token must have a resource that matches the request resource for MCP scenarios
6879
6951
  if (cachedAccessToken.resource !== request.resource) {
6880
6952
  this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
6881
- throw createClientAuthError(tokenRefreshRequired);
6953
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
6882
6954
  }
6883
6955
  }
6884
6956
  else if (cachedAccessToken.refreshOn &&
@@ -6920,21 +6992,13 @@ class SilentFlowClient {
6920
6992
  async generateResultFromCacheRecord(cacheRecord, request) {
6921
6993
  let idTokenClaims;
6922
6994
  if (cacheRecord.idToken) {
6923
- idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode);
6924
- }
6925
- // token max_age check
6926
- if (request.maxAge || request.maxAge === 0) {
6927
- const authTime = idTokenClaims?.auth_time;
6928
- if (!authTime) {
6929
- throw createClientAuthError(authTimeNotFound);
6930
- }
6931
- checkMaxAge(authTime, request.maxAge);
6995
+ idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
6932
6996
  }
6933
6997
  return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
6934
6998
  }
6935
6999
  }
6936
7000
 
6937
- /*! @azure/msal-common v16.8.0 2026-06-10 */
7001
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
6938
7002
 
6939
7003
  /*
6940
7004
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6947,6 +7011,7 @@ class SilentFlowClient {
6947
7011
  * @param logger
6948
7012
  * @param performanceClient
6949
7013
  * @returns
7014
+ * @internal
6950
7015
  */
6951
7016
  function getStandardAuthorizeRequestParameters(authOptions, request, logger, performanceClient) {
6952
7017
  // generate the correlationId if not set by the user and add
@@ -6959,7 +7024,7 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
6959
7024
  ...(request.scopes || []),
6960
7025
  ...(request.extraScopesToConsent || []),
6961
7026
  ];
6962
- addScopes(parameters, requestScopes, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
7027
+ addScopes(parameters, requestScopes, request.correlationId, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
6963
7028
  addResource(parameters, request.resource);
6964
7029
  addRedirectUri(parameters, request.redirectUri);
6965
7030
  addCorrelationId(parameters, correlationId);
@@ -7053,7 +7118,7 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
7053
7118
  if (request.embeddedClientId) {
7054
7119
  addBrokerParameters(parameters, authOptions.clientId, authOptions.redirectUri);
7055
7120
  }
7056
- addClaims(parameters, request.claims, authOptions.clientCapabilities, request.skipBrokerClaims);
7121
+ addClaims(parameters, request.correlationId, request.claims, authOptions.clientCapabilities, request.skipBrokerClaims);
7057
7122
  // If extraQueryParameters includes instance_aware its value will be added when extraQueryParameters are added
7058
7123
  if (authOptions.instanceAware &&
7059
7124
  (!request.extraQueryParameters ||
@@ -7067,6 +7132,7 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
7067
7132
  * @param authority
7068
7133
  * @param requestParameters
7069
7134
  * @returns
7135
+ * @internal
7070
7136
  */
7071
7137
  function getAuthorizeUrl(authority, requestParameters) {
7072
7138
  const queryString = mapToQueryString(requestParameters);
@@ -7083,7 +7149,7 @@ function extractLoginHint(account) {
7083
7149
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7084
7150
  }
7085
7151
 
7086
- /*! @azure/msal-common v16.8.0 2026-06-10 */
7152
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
7087
7153
 
7088
7154
  /*
7089
7155
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7103,10 +7169,10 @@ function enforceResourceParameter(isMcp, request) {
7103
7169
  if (request.resource &&
7104
7170
  (containsResourceParam(request.extraParameters) ||
7105
7171
  containsResourceParam(request.extraQueryParameters))) {
7106
- throw createClientAuthError(misplacedResourceParam);
7172
+ throw createClientAuthError(misplacedResourceParam, request.correlationId || "");
7107
7173
  }
7108
7174
  if (!request.resource) {
7109
- throw createClientAuthError(resourceParameterRequired);
7175
+ throw createClientAuthError(resourceParameterRequired, request.correlationId || "");
7110
7176
  }
7111
7177
  }
7112
7178
  function containsResourceParam(params) {
@@ -7116,7 +7182,7 @@ function containsResourceParam(params) {
7116
7182
  return Object.prototype.hasOwnProperty.call(params, "resource");
7117
7183
  }
7118
7184
 
7119
- /*! @azure/msal-common v16.8.0 2026-06-10 */
7185
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
7120
7186
  /*
7121
7187
  * Copyright (c) Microsoft Corporation. All rights reserved.
7122
7188
  * Licensed under the MIT License.
@@ -7133,7 +7199,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
7133
7199
  unexpectedError: unexpectedError
7134
7200
  });
7135
7201
 
7136
- /*! @azure/msal-common v16.8.0 2026-06-10 */
7202
+ /*! @azure/msal-common v16.10.0 2026-06-23 */
7137
7203
 
7138
7204
  /*
7139
7205
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7496,6 +7562,7 @@ class Deserializer {
7496
7562
  tokenType: serializedAT.token_type,
7497
7563
  userAssertionHash: serializedAT.userAssertionHash,
7498
7564
  resource: serializedAT.resource,
7565
+ additionalCacheKeyComponents: serializedAT.additionalCacheKeyComponents,
7499
7566
  lastUpdatedAt: Date.now().toString(),
7500
7567
  };
7501
7568
  atObjects[key] = accessToken;
@@ -7707,6 +7774,7 @@ const ApiId = {
7707
7774
  acquireTokenByClientCredential: 771,
7708
7775
  acquireTokenByOBO: 772,
7709
7776
  acquireTokenWithManagedIdentity: 773,
7777
+ acquireTokenByUserFederatedIdentityCredential: 774,
7710
7778
  acquireTokenByCode: 871,
7711
7779
  acquireTokenByRefreshToken: 872,
7712
7780
  };
@@ -7837,9 +7905,9 @@ class HttpClient {
7837
7905
  clearTimeout(timeoutId);
7838
7906
  }
7839
7907
  if (error instanceof Error && error.name === "AbortError") {
7840
- throw createAuthError(networkError, "Request timeout");
7908
+ throw createAuthError(networkError, "", "Request timeout");
7841
7909
  }
7842
- const baseAuthError = createAuthError(networkError, `Network request failed: ${error instanceof Error ? error.message : "unknown"}`);
7910
+ const baseAuthError = createAuthError(networkError, "", `Network request failed: ${error instanceof Error ? error.message : "unknown"}`);
7843
7911
  throw createNetworkError(baseAuthError, undefined, undefined, error instanceof Error ? error : undefined);
7844
7912
  }
7845
7913
  // Clean up timeout to prevent memory leaks
@@ -7854,7 +7922,7 @@ class HttpClient {
7854
7922
  };
7855
7923
  }
7856
7924
  catch (error) {
7857
- throw createAuthError(tokenParsingError, `Failed to parse response: ${error instanceof Error ? error.message : "unknown"}`);
7925
+ throw createAuthError(tokenParsingError, "", `Failed to parse response: ${error instanceof Error ? error.message : "unknown"}`);
7858
7926
  }
7859
7927
  }
7860
7928
  }
@@ -7954,14 +8022,14 @@ const ManagedIdentityErrorMessages = {
7954
8022
  [wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
7955
8023
  };
7956
8024
  class ManagedIdentityError extends AuthError {
7957
- constructor(errorCode) {
7958
- super(errorCode, ManagedIdentityErrorMessages[errorCode]);
8025
+ constructor(errorCode, correlationId) {
8026
+ super(errorCode, correlationId, ManagedIdentityErrorMessages[errorCode]);
7959
8027
  this.name = "ManagedIdentityError";
7960
8028
  Object.setPrototypeOf(this, ManagedIdentityError.prototype);
7961
8029
  }
7962
8030
  }
7963
- function createManagedIdentityError(errorCode) {
7964
- return new ManagedIdentityError(errorCode);
8031
+ function createManagedIdentityError(errorCode, correlationId) {
8032
+ return new ManagedIdentityError(errorCode, correlationId);
7965
8033
  }
7966
8034
 
7967
8035
  /*
@@ -7987,21 +8055,21 @@ class ManagedIdentityId {
7987
8055
  const userAssignedObjectId = managedIdentityIdParams?.userAssignedObjectId;
7988
8056
  if (userAssignedClientId) {
7989
8057
  if (userAssignedResourceId || userAssignedObjectId) {
7990
- throw createManagedIdentityError(invalidManagedIdentityIdType);
8058
+ throw createManagedIdentityError(invalidManagedIdentityIdType, "");
7991
8059
  }
7992
8060
  this.id = userAssignedClientId;
7993
8061
  this.idType = ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID;
7994
8062
  }
7995
8063
  else if (userAssignedResourceId) {
7996
8064
  if (userAssignedClientId || userAssignedObjectId) {
7997
- throw createManagedIdentityError(invalidManagedIdentityIdType);
8065
+ throw createManagedIdentityError(invalidManagedIdentityIdType, "");
7998
8066
  }
7999
8067
  this.id = userAssignedResourceId;
8000
8068
  this.idType = ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID;
8001
8069
  }
8002
8070
  else if (userAssignedObjectId) {
8003
8071
  if (userAssignedClientId || userAssignedResourceId) {
8004
- throw createManagedIdentityError(invalidManagedIdentityIdType);
8072
+ throw createManagedIdentityError(invalidManagedIdentityIdType, "");
8005
8073
  }
8006
8074
  this.id = userAssignedObjectId;
8007
8075
  this.idType = ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID;
@@ -8059,63 +8127,63 @@ const NodeAuthErrorMessage = {
8059
8127
  },
8060
8128
  };
8061
8129
  class NodeAuthError extends AuthError {
8062
- constructor(errorCode, errorMessage) {
8063
- super(errorCode, errorMessage);
8130
+ constructor(errorCode, correlationId, errorMessage) {
8131
+ super(errorCode, correlationId, errorMessage);
8064
8132
  this.name = "NodeAuthError";
8065
8133
  }
8066
8134
  /**
8067
8135
  * Creates an error thrown if loopback server address is of type string.
8068
8136
  */
8069
8137
  static createInvalidLoopbackAddressTypeError() {
8070
- return new NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
8138
+ return new NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, "", `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
8071
8139
  }
8072
8140
  /**
8073
8141
  * Creates an error thrown if the loopback server is unable to get a url.
8074
8142
  */
8075
8143
  static createUnableToLoadRedirectUrlError() {
8076
- return new NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
8144
+ return new NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, "", `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
8077
8145
  }
8078
8146
  /**
8079
8147
  * Creates an error thrown if the server response does not contain an auth code.
8080
8148
  */
8081
- static createNoAuthCodeInResponseError() {
8082
- return new NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
8149
+ static createNoAuthCodeInResponseError(correlationId = "") {
8150
+ return new NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, correlationId, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
8083
8151
  }
8084
8152
  /**
8085
8153
  * Creates an error thrown if the loopback server has not been spun up yet.
8086
8154
  */
8087
8155
  static createNoLoopbackServerExistsError() {
8088
- return new NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
8156
+ return new NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, "", `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
8089
8157
  }
8090
8158
  /**
8091
8159
  * Creates an error thrown if a loopback server already exists when attempting to create another one.
8092
8160
  */
8093
8161
  static createLoopbackServerAlreadyExistsError() {
8094
- return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
8162
+ return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, "", `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
8095
8163
  }
8096
8164
  /**
8097
8165
  * Creates an error thrown if the loopback server times out registering the auth code listener.
8098
8166
  */
8099
- static createLoopbackServerTimeoutError() {
8100
- return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
8167
+ static createLoopbackServerTimeoutError(correlationId = "") {
8168
+ return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, correlationId, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
8101
8169
  }
8102
8170
  /**
8103
8171
  * Creates an error thrown when the state is not present.
8104
8172
  */
8105
- static createStateNotFoundError() {
8106
- return new NodeAuthError(NodeAuthErrorMessage.stateNotFoundError.code, NodeAuthErrorMessage.stateNotFoundError.desc);
8173
+ static createStateNotFoundError(correlationId = "") {
8174
+ return new NodeAuthError(NodeAuthErrorMessage.stateNotFoundError.code, correlationId, NodeAuthErrorMessage.stateNotFoundError.desc);
8107
8175
  }
8108
8176
  /**
8109
8177
  * Creates an error thrown when client certificate was provided, but neither the SHA-1 or SHA-256 thumbprints were provided
8110
8178
  */
8111
8179
  static createThumbprintMissingError() {
8112
- return new NodeAuthError(NodeAuthErrorMessage.thumbprintMissing.code, NodeAuthErrorMessage.thumbprintMissing.desc);
8180
+ return new NodeAuthError(NodeAuthErrorMessage.thumbprintMissing.code, "", NodeAuthErrorMessage.thumbprintMissing.desc);
8113
8181
  }
8114
8182
  /**
8115
8183
  * Creates an error thrown when redirectUri is provided in an unsupported scenario
8116
8184
  */
8117
- static createRedirectUriNotSupportedError() {
8118
- return new NodeAuthError(NodeAuthErrorMessage.redirectUriNotSupported.code, NodeAuthErrorMessage.redirectUriNotSupported.desc);
8185
+ static createRedirectUriNotSupportedError(correlationId = "") {
8186
+ return new NodeAuthError(NodeAuthErrorMessage.redirectUriNotSupported.code, correlationId, NodeAuthErrorMessage.redirectUriNotSupported.desc);
8119
8187
  }
8120
8188
  }
8121
8189
 
@@ -8447,6 +8515,15 @@ class CryptoProvider {
8447
8515
  * Copyright (c) Microsoft Corporation. All rights reserved.
8448
8516
  * Licensed under the MIT License.
8449
8517
  */
8518
+ /**
8519
+ * Computes a combined hash from additional cache key components.
8520
+ * Matches the cross-SDK algorithm: sort keys → concatenate key+value → SHA-256 → Base64URL (no padding).
8521
+ */
8522
+ function computeAdditionalCacheKeyHash(components) {
8523
+ const sortedKeys = Object.keys(components).sort();
8524
+ const input = sortedKeys.map((k) => k + components[k]).join("");
8525
+ return crypto.createHash("sha256").update(input, "utf8").digest("base64url");
8526
+ }
8450
8527
  function generateCredentialKey(credential) {
8451
8528
  const familyId = (credential.credentialType === CredentialType.REFRESH_TOKEN &&
8452
8529
  credential.familyId) ||
@@ -8465,6 +8542,11 @@ function generateCredentialKey(credential) {
8465
8542
  credential.target || "",
8466
8543
  scheme,
8467
8544
  ];
8545
+ // Compute and append a combined hash from additional cache key components (e.g., fmi_path)
8546
+ if (credential.additionalCacheKeyComponents &&
8547
+ Object.keys(credential.additionalCacheKeyComponents).length > 0) {
8548
+ credentialKey.push(computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
8549
+ }
8468
8550
  return credentialKey.join(CACHE.KEY_SEPARATOR).toLowerCase();
8469
8551
  }
8470
8552
  function generateAccountKey(account) {
@@ -9196,6 +9278,9 @@ const missingTenantIdError = "missing_tenant_id_error";
9196
9278
  const userTimeoutReached = "user_timeout_reached";
9197
9279
  const invalidAssertion = "invalid_assertion";
9198
9280
  const invalidClientCredential = "invalid_client_credential";
9281
+ const emptyFicAssertion = "empty_fic_assertion";
9282
+ const conflictingUserIdentifiers = "conflicting_user_identifiers";
9283
+ const missingUserIdentifier = "missing_user_identifier";
9199
9284
  const deviceCodePollingCancelled = "device_code_polling_cancelled";
9200
9285
  const deviceCodeExpired = "device_code_expired";
9201
9286
  const deviceCodeUnknownError = "device_code_unknown_error";
@@ -9277,7 +9362,7 @@ class ClientAssertion {
9277
9362
  if (this.jwt) {
9278
9363
  return this.jwt;
9279
9364
  }
9280
- throw createClientAuthError(invalidAssertion);
9365
+ throw createClientAuthError(invalidAssertion, "");
9281
9366
  }
9282
9367
  /**
9283
9368
  * JWT format and required claims specified: https://tools.ietf.org/html/rfc7523#section-3
@@ -9346,7 +9431,7 @@ class ClientAssertion {
9346
9431
 
9347
9432
  /* eslint-disable header/header */
9348
9433
  const name = "@azure/msal-node";
9349
- const version = "5.2.4";
9434
+ const version = "5.3.0";
9350
9435
 
9351
9436
  /*
9352
9437
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9473,7 +9558,7 @@ class UsernamePasswordClient extends BaseClient {
9473
9558
  addClientId(parameters, this.config.authOptions.clientId);
9474
9559
  addUsername(parameters, request.username);
9475
9560
  addPassword(parameters, request.password);
9476
- addScopes(parameters, request.scopes);
9561
+ addScopes(parameters, request.scopes, request.correlationId);
9477
9562
  addResponseType(parameters, OAuthResponseType.IDTOKEN_TOKEN);
9478
9563
  addGrantType(parameters, GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
9479
9564
  addClientInfo(parameters);
@@ -9497,7 +9582,7 @@ class UsernamePasswordClient extends BaseClient {
9497
9582
  if (!StringUtils.isEmptyObj(request.claims) ||
9498
9583
  (this.config.authOptions.clientCapabilities &&
9499
9584
  this.config.authOptions.clientCapabilities.length > 0)) {
9500
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
9585
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
9501
9586
  }
9502
9587
  if (this.config.systemOptions.preventCorsPreflight &&
9503
9588
  request.username) {
@@ -9595,7 +9680,7 @@ class ClientApplication {
9595
9680
  this.logger.info("acquireTokenByCode called", request.correlationId || "");
9596
9681
  if (request.state && authCodePayLoad) {
9597
9682
  this.logger.info("acquireTokenByCode - validating state", request.correlationId || "");
9598
- this.validateState(request.state, authCodePayLoad.state || "");
9683
+ this.validateState(request.state, authCodePayLoad.state || "", request.correlationId || "");
9599
9684
  // eslint-disable-next-line no-param-reassign
9600
9685
  authCodePayLoad = { ...authCodePayLoad, state: "" };
9601
9686
  }
@@ -9614,7 +9699,7 @@ class ClientApplication {
9614
9699
  }
9615
9700
  catch (e) {
9616
9701
  if (e instanceof AuthError) {
9617
- e.setCorrelationId(validRequest.correlationId);
9702
+ e.correlationId = validRequest.correlationId;
9618
9703
  }
9619
9704
  serverTelemetryManager.cacheFailedRequest(e);
9620
9705
  throw e;
@@ -9644,7 +9729,7 @@ class ClientApplication {
9644
9729
  }
9645
9730
  catch (e) {
9646
9731
  if (e instanceof AuthError) {
9647
- e.setCorrelationId(validRequest.correlationId);
9732
+ e.correlationId = validRequest.correlationId;
9648
9733
  }
9649
9734
  serverTelemetryManager.cacheFailedRequest(e);
9650
9735
  throw e;
@@ -9687,7 +9772,7 @@ class ClientApplication {
9687
9772
  }
9688
9773
  catch (error) {
9689
9774
  if (error instanceof AuthError) {
9690
- error.setCorrelationId(validRequest.correlationId);
9775
+ error.correlationId = validRequest.correlationId;
9691
9776
  }
9692
9777
  serverTelemetryManager.cacheFailedRequest(error);
9693
9778
  throw error;
@@ -9741,7 +9826,7 @@ class ClientApplication {
9741
9826
  }
9742
9827
  catch (e) {
9743
9828
  if (e instanceof AuthError) {
9744
- e.setCorrelationId(validRequest.correlationId);
9829
+ e.correlationId = validRequest.correlationId;
9745
9830
  }
9746
9831
  serverTelemetryManager.cacheFailedRequest(e);
9747
9832
  throw e;
@@ -9763,12 +9848,12 @@ class ClientApplication {
9763
9848
  * @param state - Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow
9764
9849
  * @param cachedState - This string is sent back by the server with the authorization code
9765
9850
  */
9766
- validateState(state, cachedState) {
9851
+ validateState(state, cachedState, correlationId) {
9767
9852
  if (!state) {
9768
- throw NodeAuthError.createStateNotFoundError();
9853
+ throw NodeAuthError.createStateNotFoundError(correlationId);
9769
9854
  }
9770
9855
  if (state !== cachedState) {
9771
- throw createClientAuthError(stateMismatch);
9856
+ throw createClientAuthError(stateMismatch, correlationId);
9772
9857
  }
9773
9858
  }
9774
9859
  /**
@@ -10073,7 +10158,7 @@ class DeviceCodeClient extends BaseClient {
10073
10158
  */
10074
10159
  createQueryString(request) {
10075
10160
  const parameters = new Map();
10076
- addScopes(parameters, request.scopes);
10161
+ addScopes(parameters, request.scopes, request.correlationId);
10077
10162
  addClientId(parameters, this.config.authOptions.clientId);
10078
10163
  if (request.extraQueryParameters) {
10079
10164
  addExtraParameters(parameters, request.extraQueryParameters);
@@ -10081,33 +10166,34 @@ class DeviceCodeClient extends BaseClient {
10081
10166
  if (request.claims ||
10082
10167
  (this.config.authOptions.clientCapabilities &&
10083
10168
  this.config.authOptions.clientCapabilities.length > 0)) {
10084
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
10169
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
10085
10170
  }
10086
10171
  return mapToQueryString(parameters);
10087
10172
  }
10088
10173
  /**
10089
10174
  * Breaks the polling with specific conditions
10090
10175
  * @param deviceCodeExpirationTime - expiration time for the device code request
10176
+ * @param correlationId - correlation id of the request
10091
10177
  * @param userSpecifiedTimeout - developer provided timeout, to be compared against deviceCodeExpirationTime
10092
10178
  * @param userSpecifiedCancelFlag - boolean indicating the developer would like to cancel the request
10093
10179
  */
10094
- continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
10180
+ continuePolling(deviceCodeExpirationTime, correlationId, userSpecifiedTimeout, userSpecifiedCancelFlag) {
10095
10181
  if (userSpecifiedCancelFlag) {
10096
- this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true", "");
10097
- throw createClientAuthError(deviceCodePollingCancelled);
10182
+ this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true", correlationId);
10183
+ throw createClientAuthError(deviceCodePollingCancelled, correlationId);
10098
10184
  }
10099
10185
  else if (userSpecifiedTimeout &&
10100
10186
  userSpecifiedTimeout < deviceCodeExpirationTime &&
10101
10187
  nowSeconds() > userSpecifiedTimeout) {
10102
- this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`, "");
10103
- throw createClientAuthError(userTimeoutReached);
10188
+ this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`, correlationId);
10189
+ throw createClientAuthError(userTimeoutReached, correlationId);
10104
10190
  }
10105
10191
  else if (nowSeconds() > deviceCodeExpirationTime) {
10106
10192
  if (userSpecifiedTimeout) {
10107
- this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`, "");
10193
+ this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`, correlationId);
10108
10194
  }
10109
- this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`, "");
10110
- throw createClientAuthError(deviceCodeExpired);
10195
+ this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`, correlationId);
10196
+ throw createClientAuthError(deviceCodeExpired, correlationId);
10111
10197
  }
10112
10198
  return true;
10113
10199
  }
@@ -10130,7 +10216,7 @@ class DeviceCodeClient extends BaseClient {
10130
10216
  * Poll token endpoint while (device code is not expired AND operation has not been cancelled by
10131
10217
  * setting CancellationToken.cancel = true). POST request is sent at interval set by pollingIntervalMilli
10132
10218
  */
10133
- while (this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) {
10219
+ while (this.continuePolling(deviceCodeExpirationTime, request.correlationId, userSpecifiedTimeout, request.cancel)) {
10134
10220
  const thumbprint = {
10135
10221
  clientId: this.config.authOptions.clientId,
10136
10222
  authority: request.authority,
@@ -10152,7 +10238,7 @@ class DeviceCodeClient extends BaseClient {
10152
10238
  else {
10153
10239
  // for any other error, throw
10154
10240
  this.logger.info("Unexpected error in polling from the server", request.correlationId);
10155
- throw createAuthError(postRequestFailed, response.body.error);
10241
+ throw createAuthError(postRequestFailed, request.correlationId, response.body.error);
10156
10242
  }
10157
10243
  }
10158
10244
  else {
@@ -10165,7 +10251,7 @@ class DeviceCodeClient extends BaseClient {
10165
10251
  * and in the rare case the conditionals in continuePolling() may not catch everything...
10166
10252
  */
10167
10253
  this.logger.error("Polling stopped for unknown reasons.", request.correlationId);
10168
- throw createClientAuthError(deviceCodeUnknownError);
10254
+ throw createClientAuthError(deviceCodeUnknownError, request.correlationId);
10169
10255
  }
10170
10256
  /**
10171
10257
  * Creates query parameters and converts to string.
@@ -10174,7 +10260,7 @@ class DeviceCodeClient extends BaseClient {
10174
10260
  */
10175
10261
  createTokenRequestBody(request, deviceCodeResponse) {
10176
10262
  const parameters = new Map();
10177
- addScopes(parameters, request.scopes);
10263
+ addScopes(parameters, request.scopes, request.correlationId);
10178
10264
  addClientId(parameters, this.config.authOptions.clientId);
10179
10265
  addGrantType(parameters, GrantType.DEVICE_CODE_GRANT);
10180
10266
  addDeviceCode(parameters, deviceCodeResponse.deviceCode);
@@ -10191,7 +10277,7 @@ class DeviceCodeClient extends BaseClient {
10191
10277
  if (!StringUtils.isEmptyObj(request.claims) ||
10192
10278
  (this.config.authOptions.clientCapabilities &&
10193
10279
  this.config.authOptions.clientCapabilities.length > 0)) {
10194
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
10280
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
10195
10281
  }
10196
10282
  return mapToQueryString(parameters);
10197
10283
  }
@@ -10263,7 +10349,7 @@ class PublicClientApplication extends ClientApplication {
10263
10349
  }
10264
10350
  catch (e) {
10265
10351
  if (e instanceof AuthError) {
10266
- e.setCorrelationId(validRequest.correlationId);
10352
+ e.correlationId = validRequest.correlationId;
10267
10353
  }
10268
10354
  serverTelemetryManager.cacheFailedRequest(e);
10269
10355
  throw e;
@@ -10297,7 +10383,7 @@ class PublicClientApplication extends ClientApplication {
10297
10383
  if (request.redirectUri) {
10298
10384
  // If it's not a broker fallback scenario, we throw an error
10299
10385
  if (!this.config.broker.nativeBrokerPlugin) {
10300
- throw NodeAuthError.createRedirectUriNotSupportedError();
10386
+ throw NodeAuthError.createRedirectUriNotSupportedError(correlationId);
10301
10387
  }
10302
10388
  // If a redirect URI is provided for a broker flow but MSAL runtime startup failed, we fall back to the browser flow and will ignore the redirect URI provided for the broker flow
10303
10389
  request.redirectUri = "";
@@ -10317,7 +10403,7 @@ class PublicClientApplication extends ClientApplication {
10317
10403
  authCodeListenerError = e;
10318
10404
  });
10319
10405
  // Wait for server to be listening
10320
- const redirectUri = await this.waitForRedirectUri(loopbackClient);
10406
+ const redirectUri = await this.waitForRedirectUri(loopbackClient, correlationId);
10321
10407
  const validRequest = {
10322
10408
  ...remainingProperties,
10323
10409
  correlationId: correlationId,
@@ -10334,10 +10420,10 @@ class PublicClientApplication extends ClientApplication {
10334
10420
  throw authCodeListenerError;
10335
10421
  }
10336
10422
  if (authCodeResponse.error) {
10337
- throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
10423
+ throw new ServerError(authCodeResponse.error, correlationId, authCodeResponse.error_description, authCodeResponse.suberror);
10338
10424
  }
10339
10425
  else if (!authCodeResponse.code) {
10340
- throw NodeAuthError.createNoAuthCodeInResponseError();
10426
+ throw NodeAuthError.createNoAuthCodeInResponseError(correlationId);
10341
10427
  }
10342
10428
  const clientInfo = authCodeResponse.client_info;
10343
10429
  const tokenRequest = {
@@ -10382,7 +10468,7 @@ class PublicClientApplication extends ClientApplication {
10382
10468
  if (request.redirectUri) {
10383
10469
  // If it's not a broker fallback scenario, we throw an error
10384
10470
  if (!this.config.broker.nativeBrokerPlugin) {
10385
- throw NodeAuthError.createRedirectUriNotSupportedError();
10471
+ throw NodeAuthError.createRedirectUriNotSupportedError(correlationId);
10386
10472
  }
10387
10473
  request.redirectUri = "";
10388
10474
  }
@@ -10435,9 +10521,10 @@ class PublicClientApplication extends ClientApplication {
10435
10521
  /**
10436
10522
  * Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
10437
10523
  * @param loopbackClient - developer provided custom loopback server implementation
10524
+ * @param correlationId - correlation id of the request
10438
10525
  * @returns
10439
10526
  */
10440
- async waitForRedirectUri(loopbackClient) {
10527
+ async waitForRedirectUri(loopbackClient, correlationId) {
10441
10528
  return new Promise((resolve, reject) => {
10442
10529
  let ticks = 0;
10443
10530
  const id = setInterval(() => {
@@ -10445,7 +10532,7 @@ class PublicClientApplication extends ClientApplication {
10445
10532
  LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS <
10446
10533
  ticks) {
10447
10534
  clearInterval(id);
10448
- reject(NodeAuthError.createLoopbackServerTimeoutError());
10535
+ reject(NodeAuthError.createLoopbackServerTimeoutError(correlationId));
10449
10536
  return;
10450
10537
  }
10451
10538
  try {
@@ -10489,10 +10576,18 @@ class ClientCredentialClient extends BaseClient {
10489
10576
  * @param request - CommonClientCredentialRequest provided by the developer
10490
10577
  */
10491
10578
  async acquireToken(request) {
10579
+ // Build additional cache key components for FMI cache isolation
10580
+ let additionalCacheKeyComponents;
10581
+ if (request.fmiPath) {
10582
+ additionalCacheKeyComponents = {
10583
+ fmi_path: request.fmiPath,
10584
+ };
10585
+ }
10492
10586
  if (request.skipCache || request.claims) {
10493
- return this.executeTokenRequest(request, this.authority);
10587
+ return this.executeTokenRequest(request, this.authority,
10588
+ /* refreshAccessToken */ undefined, additionalCacheKeyComponents);
10494
10589
  }
10495
- const [cachedAuthenticationResult, lastCacheOutcome] = await this.getCachedAuthenticationResult(request, this.config, this.cryptoUtils, this.authority, this.cacheManager, this.serverTelemetryManager);
10590
+ const [cachedAuthenticationResult, lastCacheOutcome] = await this.getCachedAuthenticationResult(request, this.config, this.cryptoUtils, this.authority, this.cacheManager, this.serverTelemetryManager, additionalCacheKeyComponents);
10496
10591
  if (cachedAuthenticationResult) {
10497
10592
  // if the token is not expired but must be refreshed; get a new one in the background
10498
10593
  if (lastCacheOutcome ===
@@ -10500,19 +10595,20 @@ class ClientCredentialClient extends BaseClient {
10500
10595
  this.logger.info("ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.", request.correlationId);
10501
10596
  // refresh the access token in the background
10502
10597
  const refreshAccessToken = true;
10503
- await this.executeTokenRequest(request, this.authority, refreshAccessToken);
10598
+ await this.executeTokenRequest(request, this.authority, refreshAccessToken, additionalCacheKeyComponents);
10504
10599
  }
10505
10600
  // return the cached token
10506
10601
  return cachedAuthenticationResult;
10507
10602
  }
10508
10603
  else {
10509
- return this.executeTokenRequest(request, this.authority);
10604
+ return this.executeTokenRequest(request, this.authority,
10605
+ /* refreshAccessToken */ undefined, additionalCacheKeyComponents);
10510
10606
  }
10511
10607
  }
10512
10608
  /**
10513
10609
  * looks up cache if the tokens are cached already
10514
10610
  */
10515
- async getCachedAuthenticationResult(request, config, cryptoUtils, authority, cacheManager, serverTelemetryManager) {
10611
+ async getCachedAuthenticationResult(request, config, cryptoUtils, authority, cacheManager, serverTelemetryManager, additionalCacheKeyComponents) {
10516
10612
  const clientConfiguration = config;
10517
10613
  const managedIdentityConfiguration = config;
10518
10614
  let lastCacheOutcome = CacheOutcome.NOT_APPLICABLE;
@@ -10524,7 +10620,7 @@ class ClientCredentialClient extends BaseClient {
10524
10620
  await clientConfiguration.persistencePlugin.beforeCacheAccess(cacheContext);
10525
10621
  }
10526
10622
  const cachedAccessToken = this.readAccessTokenFromCache(authority, managedIdentityConfiguration.managedIdentityId?.id ||
10527
- clientConfiguration.authOptions.clientId, new ScopeSet(request.scopes || []), cacheManager, request.correlationId);
10623
+ clientConfiguration.authOptions.clientId, new ScopeSet(request.scopes || [], request.correlationId), cacheManager, request.correlationId, additionalCacheKeyComponents);
10528
10624
  if (clientConfiguration.serializableCache &&
10529
10625
  clientConfiguration.persistencePlugin &&
10530
10626
  cacheContext) {
@@ -10561,21 +10657,22 @@ class ClientCredentialClient extends BaseClient {
10561
10657
  /**
10562
10658
  * Reads access token from the cache
10563
10659
  */
10564
- readAccessTokenFromCache(authority, id, scopeSet, cacheManager, correlationId) {
10660
+ readAccessTokenFromCache(authority, id, scopeSet, cacheManager, correlationId, additionalCacheKeyComponents) {
10565
10661
  const accessTokenFilter = {
10566
10662
  homeAccountId: "",
10567
10663
  environment: authority.canonicalAuthorityUrlComponents.HostNameAndPort,
10568
10664
  credentialType: CredentialType.ACCESS_TOKEN,
10569
10665
  clientId: id,
10570
10666
  realm: authority.tenant,
10571
- target: ScopeSet.createSearchScopes(scopeSet.asArray()),
10667
+ target: ScopeSet.createSearchScopes(scopeSet.asArray(), correlationId),
10668
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
10572
10669
  };
10573
10670
  const accessTokens = cacheManager.getAccessTokensByFilter(accessTokenFilter, correlationId);
10574
10671
  if (accessTokens.length < 1) {
10575
10672
  return null;
10576
10673
  }
10577
10674
  else if (accessTokens.length > 1) {
10578
- throw createClientAuthError(multipleMatchingTokens);
10675
+ throw createClientAuthError(multipleMatchingTokens, correlationId);
10579
10676
  }
10580
10677
  return accessTokens[0];
10581
10678
  }
@@ -10584,7 +10681,7 @@ class ClientCredentialClient extends BaseClient {
10584
10681
  * @param request - CommonClientCredentialRequest provided by the developer
10585
10682
  * @param authority - authority object
10586
10683
  */
10587
- async executeTokenRequest(request, authority, refreshAccessToken) {
10684
+ async executeTokenRequest(request, authority, refreshAccessToken, additionalCacheKeyComponents) {
10588
10685
  let serverTokenResponse;
10589
10686
  let reqTimestamp;
10590
10687
  if (this.appTokenProvider) {
@@ -10628,7 +10725,12 @@ class ClientCredentialClient extends BaseClient {
10628
10725
  }
10629
10726
  const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
10630
10727
  responseHandler.validateTokenResponse(serverTokenResponse, request.correlationId, refreshAccessToken);
10631
- const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request, ApiId.acquireTokenByClientCredential);
10728
+ const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request, ApiId.acquireTokenByClientCredential, undefined, // authCodePayload
10729
+ undefined, // userAssertionHash
10730
+ undefined, // handlingRefreshTokenResponse
10731
+ undefined, // forceCacheRefreshTokenResponse
10732
+ undefined, // serverRequestId
10733
+ additionalCacheKeyComponents);
10632
10734
  return tokenResponse;
10633
10735
  }
10634
10736
  /**
@@ -10638,7 +10740,7 @@ class ClientCredentialClient extends BaseClient {
10638
10740
  async createTokenRequestBody(request) {
10639
10741
  const parameters = new Map();
10640
10742
  addClientId(parameters, this.config.authOptions.clientId);
10641
- addScopes(parameters, request.scopes, false);
10743
+ addScopes(parameters, request.scopes, request.correlationId, false);
10642
10744
  addGrantType(parameters, GrantType.CLIENT_CREDENTIALS_GRANT);
10643
10745
  addLibraryInfo(parameters, this.config.libraryInfo);
10644
10746
  addApplicationTelemetry(parameters, this.config.telemetry.application);
@@ -10656,13 +10758,16 @@ class ClientCredentialClient extends BaseClient {
10656
10758
  const clientAssertion = request.clientAssertion ||
10657
10759
  this.config.clientCredentials.clientAssertion;
10658
10760
  if (clientAssertion) {
10659
- addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
10761
+ addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, this.authority.tokenEndpoint, request.fmiPath));
10660
10762
  addClientAssertionType(parameters, clientAssertion.assertionType);
10661
10763
  }
10764
+ if (request.fmiPath) {
10765
+ parameters.set(FMI_PATH, request.fmiPath);
10766
+ }
10662
10767
  if (!StringUtils.isEmptyObj(request.claims) ||
10663
10768
  (this.config.authOptions.clientCapabilities &&
10664
10769
  this.config.authOptions.clientCapabilities.length > 0)) {
10665
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
10770
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
10666
10771
  }
10667
10772
  return mapToQueryString(parameters);
10668
10773
  }
@@ -10685,7 +10790,7 @@ class OnBehalfOfClient extends BaseClient {
10685
10790
  * @param request - developer provided CommonOnBehalfOfRequest
10686
10791
  */
10687
10792
  async acquireToken(request) {
10688
- this.scopeSet = new ScopeSet(request.scopes || []);
10793
+ this.scopeSet = new ScopeSet(request.scopes || [], request.correlationId);
10689
10794
  // generate the user_assertion_hash for OBOAssertion
10690
10795
  this.userAssertionHash = await this.cryptoUtils.hashString(request.oboAssertion);
10691
10796
  if (request.skipCache || request.claims) {
@@ -10714,20 +10819,20 @@ class OnBehalfOfClient extends BaseClient {
10714
10819
  // Must refresh due to non-existent access_token.
10715
10820
  this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
10716
10821
  this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.", request.correlationId);
10717
- throw createClientAuthError(tokenRefreshRequired);
10822
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
10718
10823
  }
10719
10824
  else if (isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
10720
10825
  // Access token expired, will need to renewed
10721
10826
  this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
10722
10827
  this.logger.info(`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`, request.correlationId);
10723
- throw createClientAuthError(tokenRefreshRequired);
10828
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
10724
10829
  }
10725
10830
  // fetch the idToken from cache
10726
10831
  const cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId, request.correlationId);
10727
10832
  let idTokenClaims;
10728
10833
  let cachedAccount = null;
10729
10834
  if (cachedIdToken) {
10730
- idTokenClaims = extractTokenClaims(cachedIdToken.secret, EncodingUtils.base64Decode);
10835
+ idTokenClaims = extractTokenClaims(cachedIdToken.secret, EncodingUtils.base64Decode, request.correlationId);
10731
10836
  const localAccountId = idTokenClaims.oid || idTokenClaims.sub;
10732
10837
  const accountInfo = {
10733
10838
  homeAccountId: cachedIdToken.homeAccountId,
@@ -10789,7 +10894,7 @@ class OnBehalfOfClient extends BaseClient {
10789
10894
  const accessTokenFilter = {
10790
10895
  credentialType: credentialType,
10791
10896
  clientId,
10792
- target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
10897
+ target: ScopeSet.createSearchScopes(this.scopeSet.asArray(), request.correlationId),
10793
10898
  tokenType: authScheme,
10794
10899
  keyId: request.sshKid,
10795
10900
  userAssertionHash: this.userAssertionHash,
@@ -10800,7 +10905,7 @@ class OnBehalfOfClient extends BaseClient {
10800
10905
  return null;
10801
10906
  }
10802
10907
  else if (numAccessTokens > 1) {
10803
- throw createClientAuthError(multipleMatchingTokens);
10908
+ throw createClientAuthError(multipleMatchingTokens, request.correlationId);
10804
10909
  }
10805
10910
  return accessTokens[0];
10806
10911
  }
@@ -10839,7 +10944,7 @@ class OnBehalfOfClient extends BaseClient {
10839
10944
  async createTokenRequestBody(request) {
10840
10945
  const parameters = new Map();
10841
10946
  addClientId(parameters, this.config.authOptions.clientId);
10842
- addScopes(parameters, request.scopes);
10947
+ addScopes(parameters, request.scopes, request.correlationId);
10843
10948
  addGrantType(parameters, GrantType.JWT_BEARER);
10844
10949
  addClientInfo(parameters);
10845
10950
  addLibraryInfo(parameters, this.config.libraryInfo);
@@ -10864,7 +10969,106 @@ class OnBehalfOfClient extends BaseClient {
10864
10969
  if (request.claims ||
10865
10970
  (this.config.authOptions.clientCapabilities &&
10866
10971
  this.config.authOptions.clientCapabilities.length > 0)) {
10867
- addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
10972
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
10973
+ }
10974
+ return mapToQueryString(parameters);
10975
+ }
10976
+ }
10977
+
10978
+ /*
10979
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10980
+ * Licensed under the MIT License.
10981
+ */
10982
+ /**
10983
+ * Client for the user_fic grant type (Leg 3 of Agent Identity).
10984
+ * Exchanges a federated identity credential (instance token) for a user-scoped token.
10985
+ * @internal
10986
+ */
10987
+ class UserFederatedIdentityCredentialClient extends BaseClient {
10988
+ constructor(configuration) {
10989
+ super(configuration);
10990
+ }
10991
+ /**
10992
+ * Acquires a token using the user_fic grant type.
10993
+ * Always hits the network (no cache lookup for the network call).
10994
+ * Developers use acquireTokenSilent for cached FIC tokens.
10995
+ */
10996
+ async acquireToken(request) {
10997
+ return this.executeTokenRequest(request, this.authority);
10998
+ }
10999
+ /**
11000
+ * Makes a network call to the token endpoint
11001
+ */
11002
+ async executeTokenRequest(request, authority) {
11003
+ // Build augmented scopes once for both thumbprint and body
11004
+ const scopeSet = new ScopeSet(request.scopes || [], request.correlationId);
11005
+ scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
11006
+ const augmentedScopes = scopeSet.asArray();
11007
+ const queryParametersString = this.createTokenQueryParameters(request);
11008
+ const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
11009
+ const requestBody = await this.createTokenRequestBody(request, augmentedScopes);
11010
+ const headers = this.createTokenRequestHeaders();
11011
+ const thumbprint = {
11012
+ clientId: this.config.authOptions.clientId,
11013
+ authority: request.authority,
11014
+ scopes: augmentedScopes,
11015
+ claims: request.claims,
11016
+ authenticationScheme: request.authenticationScheme,
11017
+ resourceRequestMethod: request.resourceRequestMethod,
11018
+ resourceRequestUri: request.resourceRequestUri,
11019
+ shrClaims: request.shrClaims,
11020
+ sshKid: request.sshKid,
11021
+ };
11022
+ const reqTimestamp = nowSeconds();
11023
+ const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
11024
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
11025
+ responseHandler.validateTokenResponse(response.body, request.correlationId);
11026
+ const tokenResponse = await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, ApiId.acquireTokenByUserFederatedIdentityCredential);
11027
+ return tokenResponse;
11028
+ }
11029
+ /**
11030
+ * Builds the request body for the user_fic grant type
11031
+ */
11032
+ async createTokenRequestBody(request, augmentedScopes) {
11033
+ const parameters = new Map();
11034
+ addClientId(parameters, this.config.authOptions.clientId);
11035
+ addScopes(parameters, augmentedScopes, request.correlationId);
11036
+ addGrantType(parameters, GrantType.USER_FIC);
11037
+ // Send client_info=1 to get homeAccountId for user cache
11038
+ addClientInfo(parameters);
11039
+ // Add the user_federated_identity_credential (instance token)
11040
+ parameters.set(USER_FEDERATED_IDENTITY_CREDENTIAL, request.assertion);
11041
+ // Add user identification: either username or user_id (object ID)
11042
+ if (request.username) {
11043
+ parameters.set(USERNAME, request.username);
11044
+ }
11045
+ else if (request.userObjectId) {
11046
+ parameters.set(USER_ID, request.userObjectId);
11047
+ }
11048
+ addLibraryInfo(parameters, this.config.libraryInfo);
11049
+ addApplicationTelemetry(parameters, this.config.telemetry.application);
11050
+ addThrottling(parameters);
11051
+ if (this.serverTelemetryManager) {
11052
+ addServerTelemetry(parameters, this.serverTelemetryManager);
11053
+ }
11054
+ const correlationId = request.correlationId ||
11055
+ this.config.cryptoInterface.createNewGuid();
11056
+ addCorrelationId(parameters, correlationId);
11057
+ // Add client credentials (secret or assertion)
11058
+ if (this.config.clientCredentials.clientSecret) {
11059
+ addClientSecret(parameters, this.config.clientCredentials.clientSecret);
11060
+ }
11061
+ // Use per-request client assertion if provided, otherwise fall back to app-level
11062
+ const clientAssertion = request.clientAssertion ||
11063
+ this.config.clientCredentials.clientAssertion;
11064
+ if (clientAssertion) {
11065
+ addClientAssertion(parameters, await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, this.authority.tokenEndpoint));
11066
+ addClientAssertionType(parameters, clientAssertion.assertionType);
11067
+ }
11068
+ if (request.claims ||
11069
+ (this.config.authOptions.clientCapabilities &&
11070
+ this.config.authOptions.clientCapabilities.length > 0)) {
11071
+ addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
10868
11072
  }
10869
11073
  return mapToQueryString(parameters);
10870
11074
  }
@@ -10918,7 +11122,7 @@ class ConfidentialClientApplication extends ClientApplication {
10918
11122
  if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
10919
11123
  (clientAssertionNotEmpty && certificateNotEmpty) ||
10920
11124
  (clientSecretNotEmpty && certificateNotEmpty)) {
10921
- throw createClientAuthError(invalidClientCredential);
11125
+ throw createClientAuthError(invalidClientCredential, "");
10922
11126
  }
10923
11127
  if (this.config.auth.clientSecret) {
10924
11128
  this.clientSecret = this.config.auth.clientSecret;
@@ -10930,7 +11134,7 @@ class ConfidentialClientApplication extends ClientApplication {
10930
11134
  return;
10931
11135
  }
10932
11136
  if (!certificateNotEmpty) {
10933
- throw createClientAuthError(invalidClientCredential);
11137
+ throw createClientAuthError(invalidClientCredential, "");
10934
11138
  }
10935
11139
  else {
10936
11140
  this.clientAssertion = !!this.config.auth.clientCertificate
@@ -10981,10 +11185,10 @@ class ConfidentialClientApplication extends ClientApplication {
10981
11185
  * valid request should not have "common" or "organizations" in lieu of the tenant_id in the authority in the auth configuration
10982
11186
  * example authority: "https://login.microsoftonline.com/TenantId",
10983
11187
  */
10984
- const authority = new UrlString(validRequest.authority);
11188
+ const authority = new UrlString(validRequest.authority, validRequest.correlationId);
10985
11189
  const tenantId = authority.getUrlComponents().PathSegments[0];
10986
11190
  if (Object.values(AADAuthority).includes(tenantId)) {
10987
- throw createClientAuthError(missingTenantIdError);
11191
+ throw createClientAuthError(missingTenantIdError, validRequest.correlationId);
10988
11192
  }
10989
11193
  /*
10990
11194
  * if this env variable is set, and the developer provided region isn't defined and isn't "DisableMsalForceRegion",
@@ -11014,7 +11218,7 @@ class ConfidentialClientApplication extends ClientApplication {
11014
11218
  }
11015
11219
  catch (e) {
11016
11220
  if (e instanceof AuthError) {
11017
- e.setCorrelationId(validRequest.correlationId);
11221
+ e.correlationId = validRequest.correlationId;
11018
11222
  }
11019
11223
  serverTelemetryManager.cacheFailedRequest(e);
11020
11224
  throw e;
@@ -11046,8 +11250,60 @@ class ConfidentialClientApplication extends ClientApplication {
11046
11250
  }
11047
11251
  catch (e) {
11048
11252
  if (e instanceof AuthError) {
11049
- e.setCorrelationId(validRequest.correlationId);
11253
+ e.correlationId = validRequest.correlationId;
11254
+ }
11255
+ throw e;
11256
+ }
11257
+ }
11258
+ /**
11259
+ * Acquires a user-scoped token using the user_fic grant type (Leg 3 of Agent Identity).
11260
+ *
11261
+ * Exchanges a federated identity credential (instance token from Leg 2) for a user-scoped token.
11262
+ * Exactly one of `userObjectId` or `username` must be provided to identify the target user.
11263
+ *
11264
+ * This method always makes a network call. Use `acquireTokenSilent` to retrieve cached FIC tokens.
11265
+ */
11266
+ async acquireTokenByUserFederatedIdentityCredential(request) {
11267
+ this.logger.info("acquireTokenByUserFederatedIdentityCredential called", request.correlationId || "");
11268
+ // Validate that exactly one user identifier is provided
11269
+ if (request.userObjectId && request.username) {
11270
+ throw createClientAuthError(conflictingUserIdentifiers, request.correlationId || "");
11271
+ }
11272
+ if (!request.userObjectId && !request.username) {
11273
+ throw createClientAuthError(missingUserIdentifier, request.correlationId || "");
11274
+ }
11275
+ // Validate that the assertion is not empty
11276
+ if (!request.assertion) {
11277
+ throw createClientAuthError(emptyFicAssertion, request.correlationId || "");
11278
+ }
11279
+ // If there is a client assertion present in the request, resolve it
11280
+ let clientAssertion;
11281
+ if (request.clientAssertion) {
11282
+ clientAssertion = {
11283
+ assertion: await getClientAssertion(request.clientAssertion, this.config.auth.clientId),
11284
+ assertionType: Constants.JWT_BEARER_ASSERTION_TYPE,
11285
+ };
11286
+ }
11287
+ const baseRequest = await this.initializeBaseRequest(request);
11288
+ const validRequest = {
11289
+ ...request,
11290
+ ...baseRequest,
11291
+ assertion: request.assertion,
11292
+ clientAssertion,
11293
+ };
11294
+ const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByUserFederatedIdentityCredential, validRequest.correlationId);
11295
+ try {
11296
+ const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, undefined, request.azureCloudOptions);
11297
+ const clientConfig = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, "", serverTelemetryManager);
11298
+ const ficClient = new UserFederatedIdentityCredentialClient(clientConfig);
11299
+ this.logger.verbose("UserFederatedIdentityCredential client created", validRequest.correlationId);
11300
+ return await ficClient.acquireToken(validRequest);
11301
+ }
11302
+ catch (e) {
11303
+ if (e instanceof AuthError) {
11304
+ e.correlationId = validRequest.correlationId;
11050
11305
  }
11306
+ serverTelemetryManager.cacheFailedRequest(e);
11051
11307
  throw e;
11052
11308
  }
11053
11309
  }
@@ -11286,7 +11542,7 @@ class BaseManagedIdentitySource {
11286
11542
  throw error;
11287
11543
  }
11288
11544
  else {
11289
- throw createClientAuthError(networkError);
11545
+ throw createClientAuthError(networkError, managedIdentityRequest.correlationId);
11290
11546
  }
11291
11547
  }
11292
11548
  const responseHandler = new ResponseHandler(managedIdentityId.id, this.nodeStorage, this.cryptoProvider, this.logger, new StubPerformanceClient(), null, null);
@@ -11325,7 +11581,7 @@ class BaseManagedIdentitySource {
11325
11581
  this.logger.info("[Managed Identity] Adding user assigned object id to the request.", "");
11326
11582
  return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_OBJECT_ID;
11327
11583
  default:
11328
- throw createManagedIdentityError(invalidManagedIdentityIdType);
11584
+ throw createManagedIdentityError(invalidManagedIdentityIdType, "");
11329
11585
  }
11330
11586
  }
11331
11587
  }
@@ -11345,11 +11601,12 @@ class BaseManagedIdentitySource {
11345
11601
  */
11346
11602
  BaseManagedIdentitySource.getValidatedEnvVariableUrlString = (envVariableStringName, envVariable, sourceName, logger) => {
11347
11603
  try {
11348
- return new UrlString(envVariable).urlString;
11604
+ // Static boot-time helper invoked from each MI source's tryCreate() before any request exists
11605
+ return new UrlString(envVariable, "").urlString;
11349
11606
  }
11350
11607
  catch (error) {
11351
11608
  logger.info(`[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed.`, "");
11352
- throw createManagedIdentityError(MsiEnvironmentVariableUrlMalformedErrorCodes[envVariableStringName]);
11609
+ throw createManagedIdentityError(MsiEnvironmentVariableUrlMalformedErrorCodes[envVariableStringName], "");
11353
11610
  }
11354
11611
  };
11355
11612
 
@@ -11675,7 +11932,7 @@ class AzureArc extends BaseManagedIdentitySource {
11675
11932
  logger.info(`[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`, "");
11676
11933
  }
11677
11934
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
11678
- throw createManagedIdentityError(unableToCreateAzureArc);
11935
+ throw createManagedIdentityError(unableToCreateAzureArc, "");
11679
11936
  }
11680
11937
  return new AzureArc(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint);
11681
11938
  }
@@ -11729,22 +11986,22 @@ class AzureArc extends BaseManagedIdentitySource {
11729
11986
  if (originalResponse.status === HTTP_UNAUTHORIZED) {
11730
11987
  const wwwAuthHeader = originalResponse.headers["www-authenticate"];
11731
11988
  if (!wwwAuthHeader) {
11732
- throw createManagedIdentityError(wwwAuthenticateHeaderMissing);
11989
+ throw createManagedIdentityError(wwwAuthenticateHeaderMissing, "");
11733
11990
  }
11734
11991
  if (!wwwAuthHeader.includes("Basic realm=")) {
11735
- throw createManagedIdentityError(wwwAuthenticateHeaderUnsupportedFormat);
11992
+ throw createManagedIdentityError(wwwAuthenticateHeaderUnsupportedFormat, "");
11736
11993
  }
11737
11994
  const secretFilePath = wwwAuthHeader.split("Basic realm=")[1];
11738
11995
  // throw an error if the managed identity application is not being run on Windows or Linux
11739
11996
  if (!SUPPORTED_AZURE_ARC_PLATFORMS.hasOwnProperty(process.platform)) {
11740
- throw createManagedIdentityError(platformNotSupported);
11997
+ throw createManagedIdentityError(platformNotSupported, "");
11741
11998
  }
11742
11999
  // get the expected Windows or Linux file path
11743
12000
  const expectedSecretFilePath = SUPPORTED_AZURE_ARC_PLATFORMS[process.platform];
11744
12001
  // throw an error if the file in the file path is not a .key file
11745
12002
  const fileName = path.basename(secretFilePath);
11746
12003
  if (!fileName.endsWith(".key")) {
11747
- throw createManagedIdentityError(invalidFileExtension);
12004
+ throw createManagedIdentityError(invalidFileExtension, "");
11748
12005
  }
11749
12006
  /*
11750
12007
  * throw an error if the file path from the www-authenticate header does not match the
@@ -11752,7 +12009,7 @@ class AzureArc extends BaseManagedIdentitySource {
11752
12009
  * is running on
11753
12010
  */
11754
12011
  if (expectedSecretFilePath + fileName !== secretFilePath) {
11755
- throw createManagedIdentityError(invalidFilePath);
12012
+ throw createManagedIdentityError(invalidFilePath, "");
11756
12013
  }
11757
12014
  let secretFileSize;
11758
12015
  // attempt to get the secret file's size, in bytes
@@ -11760,11 +12017,11 @@ class AzureArc extends BaseManagedIdentitySource {
11760
12017
  secretFileSize = await fs.statSync(secretFilePath).size;
11761
12018
  }
11762
12019
  catch (e) {
11763
- throw createManagedIdentityError(unableToReadSecretFile);
12020
+ throw createManagedIdentityError(unableToReadSecretFile, "");
11764
12021
  }
11765
12022
  // throw an error if the secret file's size is greater than 4096 bytes
11766
12023
  if (secretFileSize > AZURE_ARC_SECRET_FILE_MAX_SIZE_BYTES) {
11767
- throw createManagedIdentityError(invalidSecret);
12024
+ throw createManagedIdentityError(invalidSecret, "");
11768
12025
  }
11769
12026
  // attempt to read the contents of the secret file
11770
12027
  let secret;
@@ -11772,7 +12029,7 @@ class AzureArc extends BaseManagedIdentitySource {
11772
12029
  secret = fs.readFileSync(secretFilePath, EncodingTypes.UTF8);
11773
12030
  }
11774
12031
  catch (e) {
11775
- throw createManagedIdentityError(unableToReadSecretFile);
12032
+ throw createManagedIdentityError(unableToReadSecretFile, "");
11776
12033
  }
11777
12034
  const authHeaderValue = `Basic ${secret}`;
11778
12035
  this.logger.info(`[Managed Identity] Adding authorization header to the request.`, "");
@@ -11786,7 +12043,7 @@ class AzureArc extends BaseManagedIdentitySource {
11786
12043
  throw error;
11787
12044
  }
11788
12045
  else {
11789
- throw createClientAuthError(networkError);
12046
+ throw createClientAuthError(networkError, "");
11790
12047
  }
11791
12048
  }
11792
12049
  }
@@ -11863,7 +12120,7 @@ class CloudShell extends BaseManagedIdentitySource {
11863
12120
  const validatedMsiEndpoint = CloudShell.getValidatedEnvVariableUrlString(ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT, msiEndpoint, ManagedIdentitySourceNames.CLOUD_SHELL, logger);
11864
12121
  logger.info(`[Managed Identity] Environment variable validation passed for ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity. Endpoint URI: ${validatedMsiEndpoint}. Creating ${ManagedIdentitySourceNames.CLOUD_SHELL} managed identity.`, "");
11865
12122
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
11866
- throw createManagedIdentityError(unableToCreateCloudShell);
12123
+ throw createManagedIdentityError(unableToCreateCloudShell, "");
11867
12124
  }
11868
12125
  return new CloudShell(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, msiEndpoint);
11869
12126
  }
@@ -12403,7 +12660,7 @@ class ManagedIdentityClient {
12403
12660
  AzureArc.tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, managedIdentityId) ||
12404
12661
  Imds.tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
12405
12662
  if (!source) {
12406
- throw createManagedIdentityError(unableToCreateSource);
12663
+ throw createManagedIdentityError(unableToCreateSource, "");
12407
12664
  }
12408
12665
  return source;
12409
12666
  }
@@ -12455,7 +12712,7 @@ class ManagedIdentityApplication {
12455
12712
  */
12456
12713
  async acquireToken(managedIdentityRequestParams) {
12457
12714
  if (!managedIdentityRequestParams.resource) {
12458
- throw createClientConfigurationError(urlEmptyError);
12715
+ throw createClientConfigurationError(urlEmptyError, "");
12459
12716
  }
12460
12717
  const managedIdentityRequest = {
12461
12718
  forceRefresh: managedIdentityRequestParams.forceRefresh,