@azure/msal-node 7.1.2 → 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 +197 -87
  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.2 2026-10-27 */
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.15.0 2026-10-27 */
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.
@@ -215,7 +215,7 @@ const ATTRIBUTE_TOKENS = "attribute_tokens";
215
215
  */
216
216
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
217
217
 
218
- /*! @azure/msal-common v16.15.0 2026-10-27 */
218
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
219
219
  /*
220
220
  * Copyright (c) Microsoft Corporation. All rights reserved.
221
221
  * Licensed under the MIT License.
@@ -473,7 +473,7 @@ const EncodingTypes = {
473
473
  UTF8: "utf-8",
474
474
  };
475
475
 
476
- /*! @azure/msal-common v16.15.0 2026-10-27 */
476
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
477
477
  /*
478
478
  * Copyright (c) Microsoft Corporation. All rights reserved.
479
479
  * Licensed under the MIT License.
@@ -502,7 +502,7 @@ function createAuthError(code, correlationId, additionalMessage) {
502
502
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
503
503
  }
504
504
 
505
- /*! @azure/msal-common v16.15.0 2026-10-27 */
505
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
506
506
 
507
507
  /*
508
508
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -525,7 +525,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
525
525
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
526
526
  }
527
527
 
528
- /*! @azure/msal-common v16.15.0 2026-10-27 */
528
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
529
529
  /*
530
530
  * Copyright (c) Microsoft Corporation. All rights reserved.
531
531
  * Licensed under the MIT License.
@@ -611,7 +611,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
611
611
  userCanceled: userCanceled
612
612
  });
613
613
 
614
- /*! @azure/msal-common v16.15.0 2026-10-27 */
614
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
615
615
 
616
616
  /*
617
617
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -649,7 +649,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
649
649
  };
650
650
  }
651
651
 
652
- /*! @azure/msal-common v16.15.0 2026-10-27 */
652
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
653
653
 
654
654
  /*
655
655
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -715,7 +715,7 @@ function getJWSPayload(authToken, correlationId) {
715
715
  return matches[2];
716
716
  }
717
717
 
718
- /*! @azure/msal-common v16.15.0 2026-10-27 */
718
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
719
719
 
720
720
  /*
721
721
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -803,7 +803,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
803
803
  return updatedAccountInfo;
804
804
  }
805
805
 
806
- /*! @azure/msal-common v16.15.0 2026-10-27 */
806
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
807
807
  /*
808
808
  * Copyright (c) Microsoft Corporation. All rights reserved.
809
809
  * Licensed under the MIT License.
@@ -817,7 +817,7 @@ const AuthorityType = {
817
817
  Ciam: 3,
818
818
  };
819
819
 
820
- /*! @azure/msal-common v16.15.0 2026-10-27 */
820
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
821
821
  /*
822
822
  * Copyright (c) Microsoft Corporation. All rights reserved.
823
823
  * Licensed under the MIT License.
@@ -839,7 +839,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
839
839
  return null;
840
840
  }
841
841
 
842
- /*! @azure/msal-common v16.15.0 2026-10-27 */
842
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
843
843
  /*
844
844
  * Copyright (c) Microsoft Corporation. All rights reserved.
845
845
  * Licensed under the MIT License.
@@ -863,7 +863,7 @@ const ProtocolMode = {
863
863
  EAR: "EAR",
864
864
  };
865
865
 
866
- /*! @azure/msal-common v16.15.0 2026-10-27 */
866
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
867
867
  /**
868
868
  * Returns the AccountInfo interface for this account.
869
869
  * @internal
@@ -1012,7 +1012,7 @@ function isAccountEntity(entity) {
1012
1012
  entity.hasOwnProperty("authorityType"));
1013
1013
  }
1014
1014
 
1015
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1015
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1016
1016
  /*
1017
1017
  * Copyright (c) Microsoft Corporation. All rights reserved.
1018
1018
  * Licensed under the MIT License.
@@ -1029,7 +1029,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
1029
1029
  unexpectedError: unexpectedError
1030
1030
  });
1031
1031
 
1032
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1032
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1033
1033
 
1034
1034
  /*
1035
1035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1049,7 +1049,7 @@ function createClientConfigurationError(errorCode, correlationId) {
1049
1049
  return new ClientConfigurationError(errorCode, correlationId);
1050
1050
  }
1051
1051
 
1052
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1052
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1053
1053
  /*
1054
1054
  * Copyright (c) Microsoft Corporation. All rights reserved.
1055
1055
  * Licensed under the MIT License.
@@ -1089,7 +1089,7 @@ function getResponseHeader(headers, name) {
1089
1089
  return headerName === undefined ? undefined : headers[headerName];
1090
1090
  }
1091
1091
 
1092
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1092
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1093
1093
  /*
1094
1094
  * Copyright (c) Microsoft Corporation. All rights reserved.
1095
1095
  * Licensed under the MIT License.
@@ -1159,7 +1159,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1159
1159
  urlParseError: urlParseError
1160
1160
  });
1161
1161
 
1162
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1162
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1163
1163
  /*
1164
1164
  * Copyright (c) Microsoft Corporation. All rights reserved.
1165
1165
  * Licensed under the MIT License.
@@ -1171,7 +1171,7 @@ function isOpenIdConfigResponse(response) {
1171
1171
  response.hasOwnProperty("jwks_uri"));
1172
1172
  }
1173
1173
 
1174
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1174
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1175
1175
  /*
1176
1176
  * Copyright (c) Microsoft Corporation. All rights reserved.
1177
1177
  * Licensed under the MIT License.
@@ -1251,7 +1251,7 @@ class StringUtils {
1251
1251
  }
1252
1252
  }
1253
1253
 
1254
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1254
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1255
1255
 
1256
1256
  /*
1257
1257
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1409,7 +1409,7 @@ class UrlString {
1409
1409
  }
1410
1410
  }
1411
1411
 
1412
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1412
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1413
1413
 
1414
1414
  /*
1415
1415
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1563,7 +1563,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1563
1563
  return null;
1564
1564
  }
1565
1565
 
1566
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1566
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1567
1567
  /*
1568
1568
  * Copyright (c) Microsoft Corporation. All rights reserved.
1569
1569
  * Licensed under the MIT License.
@@ -1581,7 +1581,7 @@ const AzureCloudInstance = {
1581
1581
  AzureUsGovernment: "https://login.microsoftonline.us",
1582
1582
  };
1583
1583
 
1584
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1584
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1585
1585
  /*
1586
1586
  * Copyright (c) Microsoft Corporation. All rights reserved.
1587
1587
  * Licensed under the MIT License.
@@ -1591,7 +1591,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1591
1591
  response.hasOwnProperty("metadata"));
1592
1592
  }
1593
1593
 
1594
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1594
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1595
1595
  /*
1596
1596
  * Copyright (c) Microsoft Corporation. All rights reserved.
1597
1597
  * Licensed under the MIT License.
@@ -1601,7 +1601,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1601
1601
  response.hasOwnProperty("error_description"));
1602
1602
  }
1603
1603
 
1604
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1604
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1605
1605
  /*
1606
1606
  * Copyright (c) Microsoft Corporation. All rights reserved.
1607
1607
  * Licensed under the MIT License.
@@ -1663,7 +1663,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1663
1663
  */
1664
1664
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1665
1665
 
1666
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1666
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1667
1667
  /*
1668
1668
  * Copyright (c) Microsoft Corporation. All rights reserved.
1669
1669
  * Licensed under the MIT License.
@@ -1756,7 +1756,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1756
1756
  };
1757
1757
  };
1758
1758
 
1759
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1759
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1760
1760
 
1761
1761
  /*
1762
1762
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1867,7 +1867,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1867
1867
  },
1868
1868
  };
1869
1869
 
1870
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1870
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1871
1871
  /*
1872
1872
  * Copyright (c) Microsoft Corporation. All rights reserved.
1873
1873
  * Licensed under the MIT License.
@@ -1922,7 +1922,7 @@ function delay(t, value) {
1922
1922
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1923
1923
  }
1924
1924
 
1925
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1925
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1926
1926
 
1927
1927
  /*
1928
1928
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2209,7 +2209,7 @@ function serializeAttributeTokens(attributeTokens) {
2209
2209
  return [...attributeTokens].sort().join(" ");
2210
2210
  }
2211
2211
 
2212
- /*! @azure/msal-common v16.15.0 2026-10-27 */
2212
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2213
2213
 
2214
2214
  /*
2215
2215
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3177,7 +3177,7 @@ function buildStaticAuthorityOptions(authOptions) {
3177
3177
  };
3178
3178
  }
3179
3179
 
3180
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3180
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3181
3181
 
3182
3182
  /*
3183
3183
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3211,7 +3211,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3211
3211
  }
3212
3212
  }
3213
3213
 
3214
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3214
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3215
3215
 
3216
3216
  /*
3217
3217
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3407,7 +3407,7 @@ class ScopeSet {
3407
3407
  }
3408
3408
  }
3409
3409
 
3410
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3410
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3411
3411
 
3412
3412
  /*
3413
3413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3925,7 +3925,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3925
3925
  }
3926
3926
  }
3927
3927
 
3928
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3928
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3929
3929
 
3930
3930
  /*
3931
3931
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3992,7 +3992,7 @@ function mapToQueryString(parameters) {
3992
3992
  return queryParameterArray.join("&");
3993
3993
  }
3994
3994
 
3995
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3995
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3996
3996
 
3997
3997
  /*
3998
3998
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4040,7 +4040,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
4040
4040
  },
4041
4041
  };
4042
4042
 
4043
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4043
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4044
4044
 
4045
4045
  /*
4046
4046
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4063,7 +4063,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
4063
4063
  },
4064
4064
  };
4065
4065
 
4066
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4066
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4067
4067
  /*
4068
4068
  * Copyright (c) Microsoft Corporation. All rights reserved.
4069
4069
  * Licensed under the MIT License.
@@ -4338,12 +4338,12 @@ class Logger {
4338
4338
  }
4339
4339
  }
4340
4340
 
4341
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4341
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4342
4342
  /* eslint-disable header/header */
4343
4343
  const name$1 = "@azure/msal-common";
4344
- const version$1 = "16.15.0";
4344
+ const version$1 = "16.16.0";
4345
4345
 
4346
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4346
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4347
4347
  /*
4348
4348
  * Copyright (c) Microsoft Corporation. All rights reserved.
4349
4349
  * Licensed under the MIT License.
@@ -4351,7 +4351,7 @@ const version$1 = "16.15.0";
4351
4351
  const cacheQuotaExceeded = "cache_quota_exceeded";
4352
4352
  const cacheErrorUnknown = "cache_error_unknown";
4353
4353
 
4354
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4354
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4355
4355
 
4356
4356
  /*
4357
4357
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4389,7 +4389,7 @@ function createCacheError(e) {
4389
4389
  }
4390
4390
  }
4391
4391
 
4392
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4392
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4393
4393
 
4394
4394
  /*
4395
4395
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4638,6 +4638,7 @@ class CacheManager {
4638
4638
  };
4639
4639
  const tokenKeys = this.getTokenKeys();
4640
4640
  const currentScopes = ScopeSet.fromString(credential.target, correlationId);
4641
+ const accessTokenKeysToRemove = [];
4641
4642
  tokenKeys.accessToken.forEach((key) => {
4642
4643
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
4643
4644
  return;
@@ -4647,10 +4648,13 @@ class CacheManager {
4647
4648
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
4648
4649
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
4649
4650
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
4650
- this.removeAccessToken(key, correlationId);
4651
+ accessTokenKeysToRemove.push(key);
4651
4652
  }
4652
4653
  }
4653
4654
  });
4655
+ for (const key of accessTokenKeysToRemove) {
4656
+ await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
4657
+ }
4654
4658
  await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4655
4659
  }
4656
4660
  /**
@@ -4886,12 +4890,32 @@ class CacheManager {
4886
4890
  * @param correlationId
4887
4891
  */
4888
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) {
4889
4910
  const credential = this.getAccessTokenCredential(key, correlationId);
4890
4911
  if (!credential) {
4891
- return;
4912
+ return null;
4892
4913
  }
4893
4914
  this.removeItem(key, correlationId);
4894
4915
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4916
+ return credential;
4917
+ }
4918
+ async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
4895
4919
  // Remove Token Binding Key from key store for token-bound access token credentials
4896
4920
  if (credential.credentialType.toLowerCase() ===
4897
4921
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
@@ -4901,19 +4925,28 @@ class CacheManager {
4901
4925
  case AuthenticationScheme.DPOP.toLowerCase(): {
4902
4926
  const accessTokenWithAuthSchemeEntity = credential;
4903
4927
  const kid = accessTokenWithAuthSchemeEntity.keyId;
4904
- if (kid) {
4905
- void this.tokenBindingKeyManager
4906
- .removeTokenBindingKey(kid, correlationId)
4907
- .catch(() => {
4928
+ if (kid &&
4929
+ kid !== preservedKeyId &&
4930
+ !this.isTokenBindingKeyReferenced(kid, correlationId)) {
4931
+ try {
4932
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
4933
+ }
4934
+ catch {
4908
4935
  this.commonLogger.error("Failed to remove token binding key", correlationId);
4909
4936
  this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4910
- });
4937
+ }
4911
4938
  }
4912
4939
  break;
4913
4940
  }
4914
4941
  }
4915
4942
  }
4916
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
+ }
4917
4950
  /**
4918
4951
  * Removes all app metadata objects from cache.
4919
4952
  */
@@ -5052,6 +5085,7 @@ class CacheManager {
5052
5085
  const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
5053
5086
  const authScheme = request.authenticationScheme ||
5054
5087
  AuthenticationScheme.BEARER;
5088
+ const normalizedAuthScheme = authScheme.toLowerCase();
5055
5089
  /*
5056
5090
  * Distinguish between Bearer and PoP/SSH token cache types
5057
5091
  * Cast to lowercase to handle "bearer" from ADFS
@@ -5076,7 +5110,10 @@ class CacheManager {
5076
5110
  tokenType: authScheme,
5077
5111
  keyId: authScheme === AuthenticationScheme.SSH
5078
5112
  ? request.sshKid
5079
- : undefined,
5113
+ : normalizedAuthScheme ===
5114
+ AuthenticationScheme.DPOP.toLowerCase()
5115
+ ? request.popKid || request.dpopJkt
5116
+ : undefined,
5080
5117
  additionalCacheKeyComponents: additionalCacheKeyComponents,
5081
5118
  };
5082
5119
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5576,7 +5613,7 @@ class DefaultStorageClass extends CacheManager {
5576
5613
  }
5577
5614
  }
5578
5615
 
5579
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5616
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5580
5617
  /*
5581
5618
  * Copyright (c) Microsoft Corporation. All rights reserved.
5582
5619
  * Licensed under the MIT License.
@@ -5590,7 +5627,7 @@ class DefaultStorageClass extends CacheManager {
5590
5627
  const PerformanceEventStatus = {
5591
5628
  InProgress: 1};
5592
5629
 
5593
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5630
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5594
5631
 
5595
5632
  /*
5596
5633
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5648,7 +5685,7 @@ class StubPerformanceClient {
5648
5685
  }
5649
5686
  }
5650
5687
 
5651
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5688
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5652
5689
 
5653
5690
  /*
5654
5691
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5746,7 +5783,7 @@ function isOidcProtocolMode(config) {
5746
5783
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5747
5784
  }
5748
5785
 
5749
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5786
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5750
5787
  /*
5751
5788
  * Copyright (c) Microsoft Corporation. All rights reserved.
5752
5789
  * Licensed under the MIT License.
@@ -5773,7 +5810,7 @@ function isOidcProtocolMode(config) {
5773
5810
  }
5774
5811
  }
5775
5812
 
5776
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5813
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5777
5814
 
5778
5815
  /*
5779
5816
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5794,7 +5831,7 @@ function createJoseHeaderError(code, correlationId) {
5794
5831
  return new JoseHeaderError(code, correlationId);
5795
5832
  }
5796
5833
 
5797
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5834
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5798
5835
  /*
5799
5836
  * Copyright (c) Microsoft Corporation. All rights reserved.
5800
5837
  * Licensed under the MIT License.
@@ -5819,7 +5856,7 @@ function isPlainObject(value) {
5819
5856
  return Object.getPrototypeOf(value) === proto;
5820
5857
  }
5821
5858
 
5822
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5859
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5823
5860
  /*
5824
5861
  * Copyright (c) Microsoft Corporation. All rights reserved.
5825
5862
  * Licensed under the MIT License.
@@ -5829,7 +5866,7 @@ const missingAlgError = "missing_alg_error";
5829
5866
  const missingJwkError = "missing_jwk_error";
5830
5867
  const invalidJwkError = "invalid_jwk_error";
5831
5868
 
5832
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5869
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5833
5870
 
5834
5871
  /*
5835
5872
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5895,7 +5932,7 @@ class JoseHeader {
5895
5932
  }
5896
5933
  }
5897
5934
 
5898
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5935
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5899
5936
 
5900
5937
  /*
5901
5938
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5996,7 +6033,7 @@ class PopTokenGenerator {
5996
6033
  }
5997
6034
  }
5998
6035
 
5999
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6036
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6000
6037
 
6001
6038
  /*
6002
6039
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6046,13 +6083,22 @@ function validateDpopNonce(nonce, correlationId) {
6046
6083
  throw createClientConfigurationError(invalidDpopNonce, correlationId);
6047
6084
  }
6048
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
+ }
6049
6096
  /**
6050
6097
  * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6051
6098
  * resource-endpoint proof bindings.
6052
6099
  *
6053
- * Not exported from any public package entry point.
6054
- * This helper is internal-only until DPoP is wired into acquisition flows
6055
- * 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.
6056
6102
  *
6057
6103
  * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6058
6104
  * @internal
@@ -6107,10 +6153,11 @@ class DpopProofGenerator {
6107
6153
  */
6108
6154
  buildResourceProofClaims(params, correlationId = "") {
6109
6155
  validateDpopNonce(params.nonce, correlationId);
6156
+ const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
6110
6157
  const claims = {
6111
6158
  jti: this.cryptoUtils.createNewGuid(),
6112
- htm: normalizeHtm(params.htm, correlationId),
6113
- htu: normalizeHtu(params.htu, correlationId),
6159
+ htm: resourceContext.htm,
6160
+ htu: resourceContext.htu,
6114
6161
  ath: params.ath,
6115
6162
  iat: nowSeconds(),
6116
6163
  };
@@ -6141,7 +6188,7 @@ class DpopProofGenerator {
6141
6188
  }
6142
6189
  }
6143
6190
 
6144
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6191
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6145
6192
  /*
6146
6193
  * Copyright (c) Microsoft Corporation. All rights reserved.
6147
6194
  * Licensed under the MIT License.
@@ -6205,7 +6252,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6205
6252
  uiNotAllowed: uiNotAllowed
6206
6253
  });
6207
6254
 
6208
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6255
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6209
6256
 
6210
6257
  /*
6211
6258
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6272,7 +6319,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6272
6319
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6273
6320
  }
6274
6321
 
6275
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6322
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6276
6323
 
6277
6324
  /*
6278
6325
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6291,7 +6338,42 @@ class ServerError extends AuthError {
6291
6338
  }
6292
6339
  }
6293
6340
 
6294
- /*! @azure/msal-common v16.15.0 2026-10-27 */
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
+ }
6295
6377
  /**
6296
6378
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
6297
6379
  * @param base64Decode
@@ -6324,7 +6406,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6324
6406
  }
6325
6407
  }
6326
6408
 
6327
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6409
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6328
6410
 
6329
6411
  /*
6330
6412
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6752,7 +6834,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6752
6834
  return baseAccount;
6753
6835
  }
6754
6836
 
6755
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6837
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6756
6838
  /*
6757
6839
  * Copyright (c) Microsoft Corporation. All rights reserved.
6758
6840
  * Licensed under the MIT License.
@@ -6762,7 +6844,7 @@ const CcsCredentialType = {
6762
6844
  UPN: "UPN",
6763
6845
  };
6764
6846
 
6765
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6847
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6766
6848
  /*
6767
6849
  * Copyright (c) Microsoft Corporation. All rights reserved.
6768
6850
  * Licensed under the MIT License.
@@ -6781,7 +6863,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6781
6863
  }
6782
6864
  }
6783
6865
 
6784
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6866
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6785
6867
 
6786
6868
  /*
6787
6869
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6805,7 +6887,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6805
6887
  };
6806
6888
  }
6807
6889
 
6808
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6890
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6809
6891
 
6810
6892
  /*
6811
6893
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6895,7 +6977,7 @@ function getRetryAfterHeader(response) {
6895
6977
  return undefined;
6896
6978
  }
6897
6979
 
6898
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6980
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6899
6981
 
6900
6982
  /*
6901
6983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6926,7 +7008,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6926
7008
  return new NetworkError(error, httpStatus, responseHeaders);
6927
7009
  }
6928
7010
 
6929
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7011
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6930
7012
 
6931
7013
  /*
6932
7014
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7060,7 +7142,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
7060
7142
  return response;
7061
7143
  }
7062
7144
 
7063
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7145
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7064
7146
 
7065
7147
  /*
7066
7148
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7327,7 +7409,7 @@ class AuthorizationCodeClient {
7327
7409
  }
7328
7410
  }
7329
7411
 
7330
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7412
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7331
7413
 
7332
7414
  /*
7333
7415
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7481,7 +7563,7 @@ function extractLoginHint(account) {
7481
7563
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7482
7564
  }
7483
7565
 
7484
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7566
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7485
7567
 
7486
7568
  /*
7487
7569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7716,7 +7798,7 @@ class RefreshTokenClient {
7716
7798
  }
7717
7799
  }
7718
7800
 
7719
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7801
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7720
7802
 
7721
7803
  /*
7722
7804
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7982,7 +8064,7 @@ class ServerTelemetryManager {
7982
8064
  }
7983
8065
  }
7984
8066
 
7985
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8067
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7986
8068
 
7987
8069
  /*
7988
8070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8109,7 +8191,7 @@ class SilentFlowClient {
8109
8191
  }
8110
8192
  }
8111
8193
 
8112
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8194
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8113
8195
 
8114
8196
  /*
8115
8197
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10159,7 +10241,7 @@ class ClientAssertion {
10159
10241
 
10160
10242
  /* eslint-disable header/header */
10161
10243
  const name = "@azure/msal-node";
10162
- const version = "7.1.2";
10244
+ const version = "7.2.0";
10163
10245
 
10164
10246
  /*
10165
10247
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10869,14 +10951,18 @@ class LoopbackClient {
10869
10951
  }
10870
10952
  /**
10871
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
10872
10955
  * @param successTemplate
10873
10956
  * @param errorTemplate
10874
10957
  * @returns
10875
10958
  */
10876
- async listenForAuthCode(successTemplate, errorTemplate) {
10959
+ async listenForAuthCode(expectedState, successTemplate, errorTemplate) {
10877
10960
  if (this.server) {
10878
10961
  throw NodeAuthError.createLoopbackServerAlreadyExistsError();
10879
10962
  }
10963
+ if (!expectedState) {
10964
+ throw NodeAuthError.createStateNotFoundError("");
10965
+ }
10880
10966
  return new Promise((resolve, reject) => {
10881
10967
  this.server = http.createServer((req, res) => {
10882
10968
  const method = req.method?.toUpperCase();
@@ -10897,7 +10983,7 @@ class LoopbackClient {
10897
10983
  }
10898
10984
  else if (url === FORWARD_SLASH) {
10899
10985
  if (method === "POST") {
10900
- this.handlePostRequest(req, res, resolve, successTemplate, errorTemplate);
10986
+ this.handlePostRequest(req, res, resolve, expectedState, successTemplate, errorTemplate);
10901
10987
  return;
10902
10988
  }
10903
10989
  // GET to root — return success page (after redirect)
@@ -10919,6 +11005,11 @@ class LoopbackClient {
10919
11005
  res.end();
10920
11006
  return;
10921
11007
  }
11008
+ if (!this.isExpectedState(parsedUrl.searchParams, expectedState)) {
11009
+ res.writeHead(400);
11010
+ res.end("Invalid authorization response state.");
11011
+ return;
11012
+ }
10922
11013
  res.writeHead(400);
10923
11014
  res.end("OAuth responses must use form_post and cannot be returned in the URL.");
10924
11015
  reject(NodeAuthError.createLoopbackServerQueryResponseNotSupportedError());
@@ -10951,7 +11042,7 @@ class LoopbackClient {
10951
11042
  /**
10952
11043
  * Handles POST requests for form_post response mode
10953
11044
  */
10954
- handlePostRequest(req, res, resolve, successTemplate, errorTemplate) {
11045
+ handlePostRequest(req, res, resolve, expectedState, successTemplate, errorTemplate) {
10955
11046
  const contentType = req.headers["content-type"]?.split(";")[0]?.trim();
10956
11047
  if (contentType !== "application/x-www-form-urlencoded") {
10957
11048
  res.writeHead(415);
@@ -10976,6 +11067,12 @@ class LoopbackClient {
10976
11067
  res.end();
10977
11068
  return;
10978
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
+ }
10979
11076
  if (authCodeResponse.error) {
10980
11077
  res.writeHead(200);
10981
11078
  res.end(errorTemplate || `Error occurred: ${authCodeResponse.error}`);
@@ -10988,6 +11085,13 @@ class LoopbackClient {
10988
11085
  resolve(authCodeResponse);
10989
11086
  });
10990
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
+ }
10991
11095
  /**
10992
11096
  * Get the port that the loopback server is running on
10993
11097
  * @returns
@@ -11348,11 +11452,14 @@ class PublicClientApplication extends ClientApplication {
11348
11452
  responseMode !== ResponseMode$1.FORM_POST) {
11349
11453
  throw createClientConfigurationError(invalidResponseMode, correlationId);
11350
11454
  }
11455
+ const state = setRequestState(this.cryptoProvider, remainingProperties.state
11456
+ ? this.cryptoProvider.base64Encode(remainingProperties.state)
11457
+ : remainingProperties.state, undefined, correlationId);
11351
11458
  let authCodeResponse = {};
11352
11459
  let authCodeListenerError = null;
11353
11460
  try {
11354
11461
  const authCodeListener = loopbackClient
11355
- .listenForAuthCode(successTemplate, errorTemplate)
11462
+ .listenForAuthCode(state, successTemplate, errorTemplate)
11356
11463
  .then((response) => {
11357
11464
  authCodeResponse = response;
11358
11465
  })
@@ -11370,6 +11477,7 @@ class PublicClientApplication extends ClientApplication {
11370
11477
  responseMode: ResponseMode$1.FORM_POST,
11371
11478
  codeChallenge: challenge,
11372
11479
  codeChallengeMethod: CodeChallengeMethodValues.S256,
11480
+ state,
11373
11481
  };
11374
11482
  const authCodeUrl = await this.getAuthCodeUrl(validRequest);
11375
11483
  await openBrowser(authCodeUrl);
@@ -11377,6 +11485,7 @@ class PublicClientApplication extends ClientApplication {
11377
11485
  if (authCodeListenerError) {
11378
11486
  throw authCodeListenerError;
11379
11487
  }
11488
+ this.validateState(state, authCodeResponse.state || "", correlationId);
11380
11489
  if (authCodeResponse.error) {
11381
11490
  throw new ServerError(authCodeResponse.error, correlationId, authCodeResponse.error_description, authCodeResponse.suberror);
11382
11491
  }
@@ -11389,6 +11498,7 @@ class PublicClientApplication extends ClientApplication {
11389
11498
  codeVerifier: verifier,
11390
11499
  clientInfo: clientInfo || "",
11391
11500
  ...validRequest,
11501
+ state: remainingProperties.state,
11392
11502
  };
11393
11503
  return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
11394
11504
  }