@azure/msal-node 7.1.1 → 7.2.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 (63) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.mjs +1 -1
  3. package/dist/cache/TokenCache.mjs +1 -1
  4. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  5. package/dist/cache/serializer/Deserializer.mjs +1 -1
  6. package/dist/cache/serializer/Serializer.mjs +1 -1
  7. package/dist/client/BaseClient.mjs +1 -1
  8. package/dist/client/ClientApplication.mjs +1 -1
  9. package/dist/client/ClientAssertion.mjs +1 -1
  10. package/dist/client/ClientCredentialClient.mjs +1 -1
  11. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  12. package/dist/client/DeviceCodeClient.mjs +1 -1
  13. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  14. package/dist/client/ManagedIdentityClient.mjs +1 -1
  15. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  22. package/dist/client/OnBehalfOfClient.mjs +1 -1
  23. package/dist/client/PublicClientApplication.mjs +9 -3
  24. package/dist/client/PublicClientApplication.mjs.map +1 -1
  25. package/dist/client/SilentRequestCoalescer.mjs +1 -1
  26. package/dist/client/UserFederatedIdentityCredentialClient.mjs +1 -1
  27. package/dist/client/UsernamePasswordClient.mjs +1 -1
  28. package/dist/config/Configuration.mjs +1 -1
  29. package/dist/config/ManagedIdentityId.mjs +1 -1
  30. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  31. package/dist/crypto/CryptoProvider.mjs +1 -1
  32. package/dist/crypto/GuidGenerator.mjs +1 -1
  33. package/dist/crypto/HashUtils.mjs +1 -1
  34. package/dist/crypto/PkceGenerator.mjs +1 -1
  35. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  36. package/dist/error/ManagedIdentityError.mjs +1 -1
  37. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  38. package/dist/error/NodeAuthError.mjs +1 -1
  39. package/dist/index.mjs +1 -1
  40. package/dist/internals.mjs +1 -1
  41. package/dist/network/HttpClient.mjs +1 -1
  42. package/dist/network/HttpClientWithRetries.mjs +1 -1
  43. package/dist/network/LoopbackClient.mjs +26 -4
  44. package/dist/network/LoopbackClient.mjs.map +1 -1
  45. package/dist/packageMetadata.mjs +2 -2
  46. package/dist/protocol/Authorize.mjs +1 -1
  47. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  48. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  49. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  50. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  51. package/dist/utils/Constants.mjs +1 -1
  52. package/dist/utils/EncodingUtils.mjs +1 -1
  53. package/dist/utils/TimeUtils.mjs +1 -1
  54. package/lib/msal-node.cjs +294 -104
  55. package/lib/msal-node.cjs.map +1 -1
  56. package/package.json +2 -2
  57. package/src/client/PublicClientApplication.ts +18 -1
  58. package/src/network/LoopbackClient.ts +38 -0
  59. package/src/packageMetadata.ts +1 -1
  60. package/types/client/PublicClientApplication.d.ts.map +1 -1
  61. package/types/network/LoopbackClient.d.ts +6 -1
  62. package/types/network/LoopbackClient.d.ts.map +1 -1
  63. package/types/packageMetadata.d.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v7.1.1 2026-10-21 */
1
+ /*! @azure/msal-node v7.2.0 2026-11-05 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -151,7 +151,7 @@ class Serializer {
151
151
  }
152
152
  }
153
153
 
154
- /*! @azure/msal-common v16.14.3 2026-10-21 */
154
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
155
155
  /*
156
156
  * Copyright (c) Microsoft Corporation. All rights reserved.
157
157
  * Licensed under the MIT License.
@@ -207,9 +207,15 @@ const USER_FEDERATED_IDENTITY_CREDENTIAL = "user_federated_identity_credential";
207
207
  const USERNAME = "username";
208
208
  const USER_ID = "user_id";
209
209
  const FMI_PATH = "fmi_path";
210
- const ATTRIBUTE_TOKENS = "attribute_tokens";
210
+ const ATTRIBUTE_TOKENS = "attribute_tokens";
211
+ /**
212
+ * Popup-origin-check-done. Signals to the STS that the client verified the
213
+ * popup cannot be reached by an untrusted window, so the
214
+ * Cross-Origin-Opener-Policy response header may be omitted.
215
+ */
216
+ const POPUP_ORIGIN_CHECK_DONE = "pocd";
211
217
 
212
- /*! @azure/msal-common v16.14.3 2026-10-21 */
218
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
213
219
  /*
214
220
  * Copyright (c) Microsoft Corporation. All rights reserved.
215
221
  * Licensed under the MIT License.
@@ -467,7 +473,7 @@ const EncodingTypes = {
467
473
  UTF8: "utf-8",
468
474
  };
469
475
 
470
- /*! @azure/msal-common v16.14.3 2026-10-21 */
476
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
471
477
  /*
472
478
  * Copyright (c) Microsoft Corporation. All rights reserved.
473
479
  * Licensed under the MIT License.
@@ -496,7 +502,7 @@ function createAuthError(code, correlationId, additionalMessage) {
496
502
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
497
503
  }
498
504
 
499
- /*! @azure/msal-common v16.14.3 2026-10-21 */
505
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
500
506
 
501
507
  /*
502
508
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -519,7 +525,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
519
525
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
520
526
  }
521
527
 
522
- /*! @azure/msal-common v16.14.3 2026-10-21 */
528
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
523
529
  /*
524
530
  * Copyright (c) Microsoft Corporation. All rights reserved.
525
531
  * Licensed under the MIT License.
@@ -605,7 +611,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
605
611
  userCanceled: userCanceled
606
612
  });
607
613
 
608
- /*! @azure/msal-common v16.14.3 2026-10-21 */
614
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
609
615
 
610
616
  /*
611
617
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -643,7 +649,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
643
649
  };
644
650
  }
645
651
 
646
- /*! @azure/msal-common v16.14.3 2026-10-21 */
652
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
647
653
 
648
654
  /*
649
655
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -709,7 +715,7 @@ function getJWSPayload(authToken, correlationId) {
709
715
  return matches[2];
710
716
  }
711
717
 
712
- /*! @azure/msal-common v16.14.3 2026-10-21 */
718
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
713
719
 
714
720
  /*
715
721
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -797,7 +803,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
797
803
  return updatedAccountInfo;
798
804
  }
799
805
 
800
- /*! @azure/msal-common v16.14.3 2026-10-21 */
806
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
801
807
  /*
802
808
  * Copyright (c) Microsoft Corporation. All rights reserved.
803
809
  * Licensed under the MIT License.
@@ -811,7 +817,7 @@ const AuthorityType = {
811
817
  Ciam: 3,
812
818
  };
813
819
 
814
- /*! @azure/msal-common v16.14.3 2026-10-21 */
820
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
815
821
  /*
816
822
  * Copyright (c) Microsoft Corporation. All rights reserved.
817
823
  * Licensed under the MIT License.
@@ -833,7 +839,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
833
839
  return null;
834
840
  }
835
841
 
836
- /*! @azure/msal-common v16.14.3 2026-10-21 */
842
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
837
843
  /*
838
844
  * Copyright (c) Microsoft Corporation. All rights reserved.
839
845
  * Licensed under the MIT License.
@@ -857,7 +863,7 @@ const ProtocolMode = {
857
863
  EAR: "EAR",
858
864
  };
859
865
 
860
- /*! @azure/msal-common v16.14.3 2026-10-21 */
866
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
861
867
  /**
862
868
  * Returns the AccountInfo interface for this account.
863
869
  * @internal
@@ -1006,7 +1012,7 @@ function isAccountEntity(entity) {
1006
1012
  entity.hasOwnProperty("authorityType"));
1007
1013
  }
1008
1014
 
1009
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1015
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1010
1016
  /*
1011
1017
  * Copyright (c) Microsoft Corporation. All rights reserved.
1012
1018
  * Licensed under the MIT License.
@@ -1023,7 +1029,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
1023
1029
  unexpectedError: unexpectedError
1024
1030
  });
1025
1031
 
1026
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1032
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1027
1033
 
1028
1034
  /*
1029
1035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1043,7 +1049,47 @@ function createClientConfigurationError(errorCode, correlationId) {
1043
1049
  return new ClientConfigurationError(errorCode, correlationId);
1044
1050
  }
1045
1051
 
1046
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1052
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1053
+ /*
1054
+ * Copyright (c) Microsoft Corporation. All rights reserved.
1055
+ * Licensed under the MIT License.
1056
+ */
1057
+ // Track only our normalized copies, never caller-owned mutable inputs.
1058
+ const normalizedHeaderRecords = new WeakSet();
1059
+ /**
1060
+ * Creates a lowercase-keyed snapshot without changing header values or the input.
1061
+ * Reuses snapshots produced by this function to avoid repeated normalization.
1062
+ * @internal
1063
+ */
1064
+ function normalizeResponseHeaders(headers) {
1065
+ if (normalizedHeaderRecords.has(headers)) {
1066
+ return headers;
1067
+ }
1068
+ const normalized = Object.fromEntries(Object.entries(headers).map(([name, value]) => [
1069
+ name.toLowerCase(),
1070
+ value,
1071
+ ]));
1072
+ normalizedHeaderRecords.add(normalized);
1073
+ return normalized;
1074
+ }
1075
+ /**
1076
+ * Reads a response header case-insensitively.
1077
+ * Normalized snapshots are never scanned, even when a header is missing.
1078
+ * @internal
1079
+ */
1080
+ function getResponseHeader(headers, name) {
1081
+ const key = name.toLowerCase();
1082
+ if (Object.prototype.hasOwnProperty.call(headers, key)) {
1083
+ return headers[key];
1084
+ }
1085
+ if (normalizedHeaderRecords.has(headers)) {
1086
+ return undefined;
1087
+ }
1088
+ const headerName = Object.keys(headers).find((header) => header.toLowerCase() === key);
1089
+ return headerName === undefined ? undefined : headers[headerName];
1090
+ }
1091
+
1092
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1047
1093
  /*
1048
1094
  * Copyright (c) Microsoft Corporation. All rights reserved.
1049
1095
  * Licensed under the MIT License.
@@ -1113,7 +1159,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1113
1159
  urlParseError: urlParseError
1114
1160
  });
1115
1161
 
1116
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1162
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1117
1163
  /*
1118
1164
  * Copyright (c) Microsoft Corporation. All rights reserved.
1119
1165
  * Licensed under the MIT License.
@@ -1125,7 +1171,7 @@ function isOpenIdConfigResponse(response) {
1125
1171
  response.hasOwnProperty("jwks_uri"));
1126
1172
  }
1127
1173
 
1128
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1174
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1129
1175
  /*
1130
1176
  * Copyright (c) Microsoft Corporation. All rights reserved.
1131
1177
  * Licensed under the MIT License.
@@ -1205,7 +1251,7 @@ class StringUtils {
1205
1251
  }
1206
1252
  }
1207
1253
 
1208
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1254
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1209
1255
 
1210
1256
  /*
1211
1257
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1363,7 +1409,7 @@ class UrlString {
1363
1409
  }
1364
1410
  }
1365
1411
 
1366
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1412
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1367
1413
 
1368
1414
  /*
1369
1415
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1517,7 +1563,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1517
1563
  return null;
1518
1564
  }
1519
1565
 
1520
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1566
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1521
1567
  /*
1522
1568
  * Copyright (c) Microsoft Corporation. All rights reserved.
1523
1569
  * Licensed under the MIT License.
@@ -1535,7 +1581,7 @@ const AzureCloudInstance = {
1535
1581
  AzureUsGovernment: "https://login.microsoftonline.us",
1536
1582
  };
1537
1583
 
1538
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1584
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1539
1585
  /*
1540
1586
  * Copyright (c) Microsoft Corporation. All rights reserved.
1541
1587
  * Licensed under the MIT License.
@@ -1545,7 +1591,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1545
1591
  response.hasOwnProperty("metadata"));
1546
1592
  }
1547
1593
 
1548
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1594
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1549
1595
  /*
1550
1596
  * Copyright (c) Microsoft Corporation. All rights reserved.
1551
1597
  * Licensed under the MIT License.
@@ -1555,7 +1601,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1555
1601
  response.hasOwnProperty("error_description"));
1556
1602
  }
1557
1603
 
1558
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1604
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1559
1605
  /*
1560
1606
  * Copyright (c) Microsoft Corporation. All rights reserved.
1561
1607
  * Licensed under the MIT License.
@@ -1617,7 +1663,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1617
1663
  */
1618
1664
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1619
1665
 
1620
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1666
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1621
1667
  /*
1622
1668
  * Copyright (c) Microsoft Corporation. All rights reserved.
1623
1669
  * Licensed under the MIT License.
@@ -1710,7 +1756,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1710
1756
  };
1711
1757
  };
1712
1758
 
1713
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1759
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1714
1760
 
1715
1761
  /*
1716
1762
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1821,7 +1867,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1821
1867
  },
1822
1868
  };
1823
1869
 
1824
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1870
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1825
1871
  /*
1826
1872
  * Copyright (c) Microsoft Corporation. All rights reserved.
1827
1873
  * Licensed under the MIT License.
@@ -1876,7 +1922,7 @@ function delay(t, value) {
1876
1922
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1877
1923
  }
1878
1924
 
1879
- /*! @azure/msal-common v16.14.3 2026-10-21 */
1925
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1880
1926
 
1881
1927
  /*
1882
1928
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2163,7 +2209,7 @@ function serializeAttributeTokens(attributeTokens) {
2163
2209
  return [...attributeTokens].sort().join(" ");
2164
2210
  }
2165
2211
 
2166
- /*! @azure/msal-common v16.14.3 2026-10-21 */
2212
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2167
2213
 
2168
2214
  /*
2169
2215
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3131,7 +3177,7 @@ function buildStaticAuthorityOptions(authOptions) {
3131
3177
  };
3132
3178
  }
3133
3179
 
3134
- /*! @azure/msal-common v16.14.3 2026-10-21 */
3180
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3135
3181
 
3136
3182
  /*
3137
3183
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3165,7 +3211,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3165
3211
  }
3166
3212
  }
3167
3213
 
3168
- /*! @azure/msal-common v16.14.3 2026-10-21 */
3214
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3169
3215
 
3170
3216
  /*
3171
3217
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3361,7 +3407,7 @@ class ScopeSet {
3361
3407
  }
3362
3408
  }
3363
3409
 
3364
- /*! @azure/msal-common v16.14.3 2026-10-21 */
3410
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3365
3411
 
3366
3412
  /*
3367
3413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3657,6 +3703,20 @@ function addInstanceAware(parameters) {
3657
3703
  parameters.set(INSTANCE_AWARE, "true");
3658
3704
  }
3659
3705
  }
3706
+ /**
3707
+ * Adds `pocd=1`, telling the STS that the client verified the popup driving
3708
+ * this request cannot be reached by an untrusted window, so the
3709
+ * Cross-Origin-Opener-Policy response header may be omitted.
3710
+ *
3711
+ * Only ever added when the check passed — a negative result is signalled by
3712
+ * omitting the parameter, which keeps the STS default (apply COOP) and stays
3713
+ * compatible with library versions that never send it.
3714
+ */
3715
+ function addPopupOriginCheckDone(parameters) {
3716
+ if (!parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
3717
+ parameters.set(POPUP_ORIGIN_CHECK_DONE, "1");
3718
+ }
3719
+ }
3660
3720
  /**
3661
3721
  * Add extraParameters
3662
3722
  * @param extraParams - String dictionary containing extra parameters to be added.
@@ -3865,7 +3925,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3865
3925
  }
3866
3926
  }
3867
3927
 
3868
- /*! @azure/msal-common v16.14.3 2026-10-21 */
3928
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3869
3929
 
3870
3930
  /*
3871
3931
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3886,7 +3946,8 @@ function stripLeadingHashOrQuery(responseString) {
3886
3946
  return responseString;
3887
3947
  }
3888
3948
  /**
3889
- * Returns URL hash as server auth code response object.
3949
+ * Returns flat fragment or query parameters as an authorization response.
3950
+ * Application routes and unrecognized responses return null.
3890
3951
  */
3891
3952
  function getDeserializedResponse(responseString) {
3892
3953
  // Check if given hash is empty
@@ -3896,7 +3957,15 @@ function getDeserializedResponse(responseString) {
3896
3957
  try {
3897
3958
  // Strip the # or ? symbol if present
3898
3959
  const normalizedResponse = stripLeadingHashOrQuery(responseString);
3899
- // If # symbol was not present, above will return empty string, so give original hash value
3960
+ /*
3961
+ * Require a flat parameter name, not an application route.
3962
+ * Reject routes like #/dashboard?tab=orders&code=... and
3963
+ * #/dashboard/orders&state=..., where ?, /, or # appears before
3964
+ * the first = or &. These characters are allowed in parameter values.
3965
+ */
3966
+ if (!/^[^=&?#/]+(?:=|&|$)/.test(normalizedResponse)) {
3967
+ return null;
3968
+ }
3900
3969
  const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
3901
3970
  // Check for known response properties
3902
3971
  if (deserializedHash.code ||
@@ -3923,7 +3992,7 @@ function mapToQueryString(parameters) {
3923
3992
  return queryParameterArray.join("&");
3924
3993
  }
3925
3994
 
3926
- /*! @azure/msal-common v16.14.3 2026-10-21 */
3995
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3927
3996
 
3928
3997
  /*
3929
3998
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3971,7 +4040,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3971
4040
  },
3972
4041
  };
3973
4042
 
3974
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4043
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3975
4044
 
3976
4045
  /*
3977
4046
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3994,7 +4063,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3994
4063
  },
3995
4064
  };
3996
4065
 
3997
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4066
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3998
4067
  /*
3999
4068
  * Copyright (c) Microsoft Corporation. All rights reserved.
4000
4069
  * Licensed under the MIT License.
@@ -4269,12 +4338,12 @@ class Logger {
4269
4338
  }
4270
4339
  }
4271
4340
 
4272
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4341
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4273
4342
  /* eslint-disable header/header */
4274
4343
  const name$1 = "@azure/msal-common";
4275
- const version$1 = "16.14.3";
4344
+ const version$1 = "16.16.0";
4276
4345
 
4277
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4346
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4278
4347
  /*
4279
4348
  * Copyright (c) Microsoft Corporation. All rights reserved.
4280
4349
  * Licensed under the MIT License.
@@ -4282,7 +4351,7 @@ const version$1 = "16.14.3";
4282
4351
  const cacheQuotaExceeded = "cache_quota_exceeded";
4283
4352
  const cacheErrorUnknown = "cache_error_unknown";
4284
4353
 
4285
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4354
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4286
4355
 
4287
4356
  /*
4288
4357
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4320,7 +4389,7 @@ function createCacheError(e) {
4320
4389
  }
4321
4390
  }
4322
4391
 
4323
- /*! @azure/msal-common v16.14.3 2026-10-21 */
4392
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4324
4393
 
4325
4394
  /*
4326
4395
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4569,6 +4638,7 @@ class CacheManager {
4569
4638
  };
4570
4639
  const tokenKeys = this.getTokenKeys();
4571
4640
  const currentScopes = ScopeSet.fromString(credential.target, correlationId);
4641
+ const accessTokenKeysToRemove = [];
4572
4642
  tokenKeys.accessToken.forEach((key) => {
4573
4643
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
4574
4644
  return;
@@ -4578,10 +4648,13 @@ class CacheManager {
4578
4648
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
4579
4649
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
4580
4650
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
4581
- this.removeAccessToken(key, correlationId);
4651
+ accessTokenKeysToRemove.push(key);
4582
4652
  }
4583
4653
  }
4584
4654
  });
4655
+ for (const key of accessTokenKeysToRemove) {
4656
+ await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
4657
+ }
4585
4658
  await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4586
4659
  }
4587
4660
  /**
@@ -4817,12 +4890,32 @@ class CacheManager {
4817
4890
  * @param correlationId
4818
4891
  */
4819
4892
  removeAccessToken(key, correlationId) {
4893
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4894
+ if (credential) {
4895
+ void this.removeTokenBindingKeyForCredential(credential, correlationId);
4896
+ }
4897
+ }
4898
+ /**
4899
+ * Removes an access token and waits for any unreferenced token-binding key
4900
+ * cleanup. Internal callers that require deterministic cleanup should use
4901
+ * this method instead of the synchronous public cache contract.
4902
+ */
4903
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
4904
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4905
+ if (credential) {
4906
+ await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
4907
+ }
4908
+ }
4909
+ removeAccessTokenCredential(key, correlationId) {
4820
4910
  const credential = this.getAccessTokenCredential(key, correlationId);
4821
4911
  if (!credential) {
4822
- return;
4912
+ return null;
4823
4913
  }
4824
4914
  this.removeItem(key, correlationId);
4825
4915
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4916
+ return credential;
4917
+ }
4918
+ async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
4826
4919
  // Remove Token Binding Key from key store for token-bound access token credentials
4827
4920
  if (credential.credentialType.toLowerCase() ===
4828
4921
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
@@ -4832,19 +4925,28 @@ class CacheManager {
4832
4925
  case AuthenticationScheme.DPOP.toLowerCase(): {
4833
4926
  const accessTokenWithAuthSchemeEntity = credential;
4834
4927
  const kid = accessTokenWithAuthSchemeEntity.keyId;
4835
- if (kid) {
4836
- void this.tokenBindingKeyManager
4837
- .removeTokenBindingKey(kid, correlationId)
4838
- .catch(() => {
4928
+ if (kid &&
4929
+ kid !== preservedKeyId &&
4930
+ !this.isTokenBindingKeyReferenced(kid, correlationId)) {
4931
+ try {
4932
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
4933
+ }
4934
+ catch {
4839
4935
  this.commonLogger.error("Failed to remove token binding key", correlationId);
4840
4936
  this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4841
- });
4937
+ }
4842
4938
  }
4843
4939
  break;
4844
4940
  }
4845
4941
  }
4846
4942
  }
4847
4943
  }
4944
+ isTokenBindingKeyReferenced(keyId, correlationId) {
4945
+ return this.getTokenKeys().accessToken.some((accessTokenKey) => {
4946
+ const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
4947
+ return accessToken?.keyId === keyId;
4948
+ });
4949
+ }
4848
4950
  /**
4849
4951
  * Removes all app metadata objects from cache.
4850
4952
  */
@@ -4983,6 +5085,7 @@ class CacheManager {
4983
5085
  const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
4984
5086
  const authScheme = request.authenticationScheme ||
4985
5087
  AuthenticationScheme.BEARER;
5088
+ const normalizedAuthScheme = authScheme.toLowerCase();
4986
5089
  /*
4987
5090
  * Distinguish between Bearer and PoP/SSH token cache types
4988
5091
  * Cast to lowercase to handle "bearer" from ADFS
@@ -5007,7 +5110,10 @@ class CacheManager {
5007
5110
  tokenType: authScheme,
5008
5111
  keyId: authScheme === AuthenticationScheme.SSH
5009
5112
  ? request.sshKid
5010
- : undefined,
5113
+ : normalizedAuthScheme ===
5114
+ AuthenticationScheme.DPOP.toLowerCase()
5115
+ ? request.popKid || request.dpopJkt
5116
+ : undefined,
5011
5117
  additionalCacheKeyComponents: additionalCacheKeyComponents,
5012
5118
  };
5013
5119
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5507,7 +5613,7 @@ class DefaultStorageClass extends CacheManager {
5507
5613
  }
5508
5614
  }
5509
5615
 
5510
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5616
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5511
5617
  /*
5512
5618
  * Copyright (c) Microsoft Corporation. All rights reserved.
5513
5619
  * Licensed under the MIT License.
@@ -5521,7 +5627,7 @@ class DefaultStorageClass extends CacheManager {
5521
5627
  const PerformanceEventStatus = {
5522
5628
  InProgress: 1};
5523
5629
 
5524
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5630
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5525
5631
 
5526
5632
  /*
5527
5633
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5579,7 +5685,7 @@ class StubPerformanceClient {
5579
5685
  }
5580
5686
  }
5581
5687
 
5582
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5688
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5583
5689
 
5584
5690
  /*
5585
5691
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5677,7 +5783,7 @@ function isOidcProtocolMode(config) {
5677
5783
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5678
5784
  }
5679
5785
 
5680
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5786
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5681
5787
  /*
5682
5788
  * Copyright (c) Microsoft Corporation. All rights reserved.
5683
5789
  * Licensed under the MIT License.
@@ -5704,7 +5810,7 @@ function isOidcProtocolMode(config) {
5704
5810
  }
5705
5811
  }
5706
5812
 
5707
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5813
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5708
5814
 
5709
5815
  /*
5710
5816
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5725,7 +5831,7 @@ function createJoseHeaderError(code, correlationId) {
5725
5831
  return new JoseHeaderError(code, correlationId);
5726
5832
  }
5727
5833
 
5728
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5834
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5729
5835
  /*
5730
5836
  * Copyright (c) Microsoft Corporation. All rights reserved.
5731
5837
  * Licensed under the MIT License.
@@ -5750,7 +5856,7 @@ function isPlainObject(value) {
5750
5856
  return Object.getPrototypeOf(value) === proto;
5751
5857
  }
5752
5858
 
5753
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5859
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5754
5860
  /*
5755
5861
  * Copyright (c) Microsoft Corporation. All rights reserved.
5756
5862
  * Licensed under the MIT License.
@@ -5760,7 +5866,7 @@ const missingAlgError = "missing_alg_error";
5760
5866
  const missingJwkError = "missing_jwk_error";
5761
5867
  const invalidJwkError = "invalid_jwk_error";
5762
5868
 
5763
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5869
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5764
5870
 
5765
5871
  /*
5766
5872
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5826,7 +5932,7 @@ class JoseHeader {
5826
5932
  }
5827
5933
  }
5828
5934
 
5829
- /*! @azure/msal-common v16.14.3 2026-10-21 */
5935
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5830
5936
 
5831
5937
  /*
5832
5938
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5927,7 +6033,7 @@ class PopTokenGenerator {
5927
6033
  }
5928
6034
  }
5929
6035
 
5930
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6036
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5931
6037
 
5932
6038
  /*
5933
6039
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5977,13 +6083,22 @@ function validateDpopNonce(nonce, correlationId) {
5977
6083
  throw createClientConfigurationError(invalidDpopNonce, correlationId);
5978
6084
  }
5979
6085
  }
6086
+ /**
6087
+ * Validates and normalizes the HTTP resource context for a DPoP-bound request.
6088
+ * @internal
6089
+ */
6090
+ function normalizeDpopResourceRequestContext(context, correlationId = "") {
6091
+ return {
6092
+ htm: normalizeHtm(context.htm, correlationId),
6093
+ htu: normalizeHtu(context.htu, correlationId),
6094
+ };
6095
+ }
5980
6096
  /**
5981
6097
  * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
5982
6098
  * resource-endpoint proof bindings.
5983
6099
  *
5984
- * Not exported from any public package entry point.
5985
- * This helper is internal-only until DPoP is wired into acquisition flows
5986
- * in a subsequent work item.
6100
+ * Exported from package entry points for use by MSAL Browser.
6101
+ * This helper remains an unsupported internal API for direct consumers.
5987
6102
  *
5988
6103
  * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
5989
6104
  * @internal
@@ -6038,10 +6153,11 @@ class DpopProofGenerator {
6038
6153
  */
6039
6154
  buildResourceProofClaims(params, correlationId = "") {
6040
6155
  validateDpopNonce(params.nonce, correlationId);
6156
+ const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
6041
6157
  const claims = {
6042
6158
  jti: this.cryptoUtils.createNewGuid(),
6043
- htm: normalizeHtm(params.htm, correlationId),
6044
- htu: normalizeHtu(params.htu, correlationId),
6159
+ htm: resourceContext.htm,
6160
+ htu: resourceContext.htu,
6045
6161
  ath: params.ath,
6046
6162
  iat: nowSeconds(),
6047
6163
  };
@@ -6072,7 +6188,7 @@ class DpopProofGenerator {
6072
6188
  }
6073
6189
  }
6074
6190
 
6075
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6191
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6076
6192
  /*
6077
6193
  * Copyright (c) Microsoft Corporation. All rights reserved.
6078
6194
  * Licensed under the MIT License.
@@ -6136,7 +6252,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6136
6252
  uiNotAllowed: uiNotAllowed
6137
6253
  });
6138
6254
 
6139
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6255
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6140
6256
 
6141
6257
  /*
6142
6258
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6203,7 +6319,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6203
6319
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6204
6320
  }
6205
6321
 
6206
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6322
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6207
6323
 
6208
6324
  /*
6209
6325
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6222,7 +6338,42 @@ class ServerError extends AuthError {
6222
6338
  }
6223
6339
  }
6224
6340
 
6225
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6341
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6342
+
6343
+ /*
6344
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6345
+ * Licensed under the MIT License.
6346
+ */
6347
+ /**
6348
+ * Appends user state with random guid, or returns random guid.
6349
+ * @param cryptoObj
6350
+ * @param userState
6351
+ * @param meta
6352
+ * @param correlationId
6353
+ */
6354
+ function setRequestState(cryptoObj, userState, meta, correlationId) {
6355
+ const libraryState = generateLibraryState(cryptoObj, correlationId);
6356
+ return userState
6357
+ ? `${libraryState}${RESOURCE_DELIM}${userState}`
6358
+ : libraryState;
6359
+ }
6360
+ /**
6361
+ * Generates the state value used by the common library.
6362
+ * @param cryptoObj
6363
+ * @param correlationId
6364
+ * @param meta
6365
+ */
6366
+ function generateLibraryState(cryptoObj, correlationId, meta) {
6367
+ if (!cryptoObj) {
6368
+ throw createClientAuthError(noCryptoObject, correlationId);
6369
+ }
6370
+ // Create a state object containing a unique id and the timestamp of the request creation
6371
+ const stateObj = {
6372
+ id: cryptoObj.createNewGuid(),
6373
+ };
6374
+ const stateString = JSON.stringify(stateObj);
6375
+ return cryptoObj.base64Encode(stateString);
6376
+ }
6226
6377
  /**
6227
6378
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
6228
6379
  * @param base64Decode
@@ -6255,7 +6406,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6255
6406
  }
6256
6407
  }
6257
6408
 
6258
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6409
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6259
6410
 
6260
6411
  /*
6261
6412
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6683,7 +6834,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6683
6834
  return baseAccount;
6684
6835
  }
6685
6836
 
6686
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6837
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6687
6838
  /*
6688
6839
  * Copyright (c) Microsoft Corporation. All rights reserved.
6689
6840
  * Licensed under the MIT License.
@@ -6693,7 +6844,7 @@ const CcsCredentialType = {
6693
6844
  UPN: "UPN",
6694
6845
  };
6695
6846
 
6696
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6847
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6697
6848
  /*
6698
6849
  * Copyright (c) Microsoft Corporation. All rights reserved.
6699
6850
  * Licensed under the MIT License.
@@ -6712,7 +6863,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6712
6863
  }
6713
6864
  }
6714
6865
 
6715
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6866
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6716
6867
 
6717
6868
  /*
6718
6869
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6736,7 +6887,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6736
6887
  };
6737
6888
  }
6738
6889
 
6739
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6890
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6740
6891
 
6741
6892
  /*
6742
6893
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6771,13 +6922,14 @@ class ThrottlingUtils {
6771
6922
  * Performs necessary throttling checks after a network request.
6772
6923
  * @param cacheManager
6773
6924
  * @param thumbprint
6774
- * @param response
6925
+ * @param response - Token response with case-insensitive header names.
6775
6926
  */
6776
6927
  static postProcess(cacheManager, thumbprint, response, correlationId) {
6928
+ const retryAfter = getRetryAfterHeader(response);
6777
6929
  if (ThrottlingUtils.checkResponseStatus(response) ||
6778
- ThrottlingUtils.checkResponseForRetryAfter(response)) {
6930
+ retryAfter !== undefined) {
6779
6931
  const thumbprintValue = {
6780
- throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
6932
+ throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(retryAfter || "")),
6781
6933
  error: response.body.error,
6782
6934
  errorCodes: response.body.error_codes,
6783
6935
  errorMessage: response.body.error_description,
@@ -6796,14 +6948,10 @@ class ThrottlingUtils {
6796
6948
  }
6797
6949
  /**
6798
6950
  * Checks a NetworkResponse object's RetryAfter header
6799
- * @param response
6951
+ * @param response - Token response with case-insensitive header names.
6800
6952
  */
6801
6953
  static checkResponseForRetryAfter(response) {
6802
- if (response.headers) {
6803
- return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
6804
- (response.status < 200 || response.status >= 300));
6805
- }
6806
- return false;
6954
+ return getRetryAfterHeader(response) !== undefined;
6807
6955
  }
6808
6956
  /**
6809
6957
  * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
@@ -6820,9 +6968,16 @@ class ThrottlingUtils {
6820
6968
  const key = this.generateThrottlingStorageKey(thumbprint);
6821
6969
  cacheManager.removeItem(key, request.correlationId);
6822
6970
  }
6971
+ }
6972
+ /** Reads Retry-After only for non-success responses. */
6973
+ function getRetryAfterHeader(response) {
6974
+ if ((response.status < 200 || response.status >= 300) && response.headers) {
6975
+ return getResponseHeader(response.headers, HeaderNames.RETRY_AFTER);
6976
+ }
6977
+ return undefined;
6823
6978
  }
6824
6979
 
6825
- /*! @azure/msal-common v16.14.3 2026-10-21 */
6980
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6826
6981
 
6827
6982
  /*
6828
6983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6853,7 +7008,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6853
7008
  return new NetworkError(error, httpStatus, responseHeaders);
6854
7009
  }
6855
7010
 
6856
- /*! @azure/msal-common v16.14.3 2026-10-21 */
7011
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6857
7012
 
6858
7013
  /*
6859
7014
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6951,7 +7106,8 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6951
7106
  let response;
6952
7107
  try {
6953
7108
  response = await invokeAsync((networkClient.sendPostRequestAsync.bind(networkClient)), NetworkClientSendPostRequestAsync, logger, performanceClient, correlationId)(tokenEndpoint, { ...options, correlationId, performanceClient });
6954
- const responseHeaders = response.headers || {};
7109
+ const responseHeaders = normalizeResponseHeaders(response.headers || {});
7110
+ response = { ...response, headers: responseHeaders };
6955
7111
  performanceClient?.addFields({
6956
7112
  refreshTokenSize: response.body.refresh_token?.length || 0,
6957
7113
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
@@ -6960,16 +7116,16 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6960
7116
  }
6961
7117
  catch (e) {
6962
7118
  if (e instanceof NetworkError) {
6963
- const responseHeaders = e.responseHeaders;
7119
+ const responseHeaders = e.responseHeaders
7120
+ ? normalizeResponseHeaders(e.responseHeaders)
7121
+ : undefined;
6964
7122
  if (responseHeaders) {
6965
7123
  performanceClient?.addFields({
6966
7124
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] ||
6967
7125
  "",
6968
7126
  requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
6969
- contentTypeHeader: responseHeaders[HeaderNames.CONTENT_TYPE] ||
6970
- undefined,
6971
- contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] ||
6972
- undefined,
7127
+ contentTypeHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_TYPE) || undefined,
7128
+ contentLengthHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_LENGTH) || undefined,
6973
7129
  httpStatus: e.httpStatus,
6974
7130
  }, correlationId);
6975
7131
  }
@@ -6986,7 +7142,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6986
7142
  return response;
6987
7143
  }
6988
7144
 
6989
- /*! @azure/msal-common v16.14.3 2026-10-21 */
7145
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6990
7146
 
6991
7147
  /*
6992
7148
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7230,6 +7386,9 @@ class AuthorizationCodeClient {
7230
7386
  if (request.logoutHint) {
7231
7387
  addLogoutHint(parameters, request.logoutHint);
7232
7388
  }
7389
+ if (request.popupOriginCheckDone) {
7390
+ addPopupOriginCheckDone(parameters);
7391
+ }
7233
7392
  if (request.extraQueryParameters) {
7234
7393
  addExtraParameters(parameters, request.extraQueryParameters);
7235
7394
  }
@@ -7250,7 +7409,7 @@ class AuthorizationCodeClient {
7250
7409
  }
7251
7410
  }
7252
7411
 
7253
- /*! @azure/msal-common v16.14.3 2026-10-21 */
7412
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7254
7413
 
7255
7414
  /*
7256
7415
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7377,6 +7536,9 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
7377
7536
  !Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
7378
7537
  addInstanceAware(parameters);
7379
7538
  }
7539
+ if (request.popupOriginCheckDone) {
7540
+ addPopupOriginCheckDone(parameters);
7541
+ }
7380
7542
  return parameters;
7381
7543
  }
7382
7544
  /**
@@ -7401,7 +7563,7 @@ function extractLoginHint(account) {
7401
7563
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7402
7564
  }
7403
7565
 
7404
- /*! @azure/msal-common v16.14.3 2026-10-21 */
7566
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7405
7567
 
7406
7568
  /*
7407
7569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7636,7 +7798,7 @@ class RefreshTokenClient {
7636
7798
  }
7637
7799
  }
7638
7800
 
7639
- /*! @azure/msal-common v16.14.3 2026-10-21 */
7801
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7640
7802
 
7641
7803
  /*
7642
7804
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7902,7 +8064,7 @@ class ServerTelemetryManager {
7902
8064
  }
7903
8065
  }
7904
8066
 
7905
- /*! @azure/msal-common v16.14.3 2026-10-21 */
8067
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7906
8068
 
7907
8069
  /*
7908
8070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8029,7 +8191,7 @@ class SilentFlowClient {
8029
8191
  }
8030
8192
  }
8031
8193
 
8032
- /*! @azure/msal-common v16.14.3 2026-10-21 */
8194
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8033
8195
 
8034
8196
  /*
8035
8197
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10079,7 +10241,7 @@ class ClientAssertion {
10079
10241
 
10080
10242
  /* eslint-disable header/header */
10081
10243
  const name = "@azure/msal-node";
10082
- const version = "7.1.1";
10244
+ const version = "7.2.0";
10083
10245
 
10084
10246
  /*
10085
10247
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10789,14 +10951,18 @@ class LoopbackClient {
10789
10951
  }
10790
10952
  /**
10791
10953
  * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
10954
+ * @param expectedState - State sent in the authorization request
10792
10955
  * @param successTemplate
10793
10956
  * @param errorTemplate
10794
10957
  * @returns
10795
10958
  */
10796
- async listenForAuthCode(successTemplate, errorTemplate) {
10959
+ async listenForAuthCode(expectedState, successTemplate, errorTemplate) {
10797
10960
  if (this.server) {
10798
10961
  throw NodeAuthError.createLoopbackServerAlreadyExistsError();
10799
10962
  }
10963
+ if (!expectedState) {
10964
+ throw NodeAuthError.createStateNotFoundError("");
10965
+ }
10800
10966
  return new Promise((resolve, reject) => {
10801
10967
  this.server = http.createServer((req, res) => {
10802
10968
  const method = req.method?.toUpperCase();
@@ -10817,7 +10983,7 @@ class LoopbackClient {
10817
10983
  }
10818
10984
  else if (url === FORWARD_SLASH) {
10819
10985
  if (method === "POST") {
10820
- this.handlePostRequest(req, res, resolve, successTemplate, errorTemplate);
10986
+ this.handlePostRequest(req, res, resolve, expectedState, successTemplate, errorTemplate);
10821
10987
  return;
10822
10988
  }
10823
10989
  // GET to root — return success page (after redirect)
@@ -10839,6 +11005,11 @@ class LoopbackClient {
10839
11005
  res.end();
10840
11006
  return;
10841
11007
  }
11008
+ if (!this.isExpectedState(parsedUrl.searchParams, expectedState)) {
11009
+ res.writeHead(400);
11010
+ res.end("Invalid authorization response state.");
11011
+ return;
11012
+ }
10842
11013
  res.writeHead(400);
10843
11014
  res.end("OAuth responses must use form_post and cannot be returned in the URL.");
10844
11015
  reject(NodeAuthError.createLoopbackServerQueryResponseNotSupportedError());
@@ -10871,7 +11042,7 @@ class LoopbackClient {
10871
11042
  /**
10872
11043
  * Handles POST requests for form_post response mode
10873
11044
  */
10874
- handlePostRequest(req, res, resolve, successTemplate, errorTemplate) {
11045
+ handlePostRequest(req, res, resolve, expectedState, successTemplate, errorTemplate) {
10875
11046
  const contentType = req.headers["content-type"]?.split(";")[0]?.trim();
10876
11047
  if (contentType !== "application/x-www-form-urlencoded") {
10877
11048
  res.writeHead(415);
@@ -10896,6 +11067,12 @@ class LoopbackClient {
10896
11067
  res.end();
10897
11068
  return;
10898
11069
  }
11070
+ // Unrelated callbacks must not settle or cancel the pending sign-in.
11071
+ if (!this.isExpectedState(new URLSearchParams(body), expectedState)) {
11072
+ res.writeHead(400);
11073
+ res.end("Invalid authorization response state.");
11074
+ return;
11075
+ }
10899
11076
  if (authCodeResponse.error) {
10900
11077
  res.writeHead(200);
10901
11078
  res.end(errorTemplate || `Error occurred: ${authCodeResponse.error}`);
@@ -10908,6 +11085,13 @@ class LoopbackClient {
10908
11085
  resolve(authCodeResponse);
10909
11086
  });
10910
11087
  }
11088
+ /**
11089
+ * Requires exactly one state value matching the pending authorization request.
11090
+ */
11091
+ isExpectedState(parameters, expectedState) {
11092
+ const states = parameters.getAll("state");
11093
+ return states.length === 1 && states[0] === expectedState;
11094
+ }
10911
11095
  /**
10912
11096
  * Get the port that the loopback server is running on
10913
11097
  * @returns
@@ -11268,11 +11452,14 @@ class PublicClientApplication extends ClientApplication {
11268
11452
  responseMode !== ResponseMode$1.FORM_POST) {
11269
11453
  throw createClientConfigurationError(invalidResponseMode, correlationId);
11270
11454
  }
11455
+ const state = setRequestState(this.cryptoProvider, remainingProperties.state
11456
+ ? this.cryptoProvider.base64Encode(remainingProperties.state)
11457
+ : remainingProperties.state, undefined, correlationId);
11271
11458
  let authCodeResponse = {};
11272
11459
  let authCodeListenerError = null;
11273
11460
  try {
11274
11461
  const authCodeListener = loopbackClient
11275
- .listenForAuthCode(successTemplate, errorTemplate)
11462
+ .listenForAuthCode(state, successTemplate, errorTemplate)
11276
11463
  .then((response) => {
11277
11464
  authCodeResponse = response;
11278
11465
  })
@@ -11290,6 +11477,7 @@ class PublicClientApplication extends ClientApplication {
11290
11477
  responseMode: ResponseMode$1.FORM_POST,
11291
11478
  codeChallenge: challenge,
11292
11479
  codeChallengeMethod: CodeChallengeMethodValues.S256,
11480
+ state,
11293
11481
  };
11294
11482
  const authCodeUrl = await this.getAuthCodeUrl(validRequest);
11295
11483
  await openBrowser(authCodeUrl);
@@ -11297,6 +11485,7 @@ class PublicClientApplication extends ClientApplication {
11297
11485
  if (authCodeListenerError) {
11298
11486
  throw authCodeListenerError;
11299
11487
  }
11488
+ this.validateState(state, authCodeResponse.state || "", correlationId);
11300
11489
  if (authCodeResponse.error) {
11301
11490
  throw new ServerError(authCodeResponse.error, correlationId, authCodeResponse.error_description, authCodeResponse.suberror);
11302
11491
  }
@@ -11309,6 +11498,7 @@ class PublicClientApplication extends ClientApplication {
11309
11498
  codeVerifier: verifier,
11310
11499
  clientInfo: clientInfo || "",
11311
11500
  ...validRequest,
11501
+ state: remainingProperties.state,
11312
11502
  };
11313
11503
  return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
11314
11504
  }