@azure/msal-node 5.0.6 → 5.1.1

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 (85) hide show
  1. package/README.md +2 -0
  2. package/dist/cache/CacheHelpers.mjs +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.d.ts.map +1 -1
  7. package/dist/cache/serializer/Deserializer.mjs +2 -1
  8. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  9. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  10. package/dist/cache/serializer/Serializer.mjs +2 -1
  11. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  12. package/dist/cache/serializer/SerializerTypes.d.ts +1 -0
  13. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
  14. package/dist/client/BaseClient.mjs +1 -1
  15. package/dist/client/ClientApplication.d.ts.map +1 -1
  16. package/dist/client/ClientApplication.mjs +2 -1
  17. package/dist/client/ClientApplication.mjs.map +1 -1
  18. package/dist/client/ClientAssertion.mjs +1 -1
  19. package/dist/client/ClientCredentialClient.mjs +1 -1
  20. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  21. package/dist/client/DeviceCodeClient.mjs +1 -1
  22. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  23. package/dist/client/ManagedIdentityClient.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  25. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  26. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  27. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  28. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  29. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  30. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  31. package/dist/client/OnBehalfOfClient.mjs +1 -1
  32. package/dist/client/PublicClientApplication.d.ts +13 -1
  33. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  34. package/dist/client/PublicClientApplication.mjs +21 -2
  35. package/dist/client/PublicClientApplication.mjs.map +1 -1
  36. package/dist/client/UsernamePasswordClient.mjs +1 -1
  37. package/dist/config/Configuration.d.ts +4 -0
  38. package/dist/config/Configuration.d.ts.map +1 -1
  39. package/dist/config/Configuration.mjs +2 -1
  40. package/dist/config/Configuration.mjs.map +1 -1
  41. package/dist/config/ManagedIdentityId.mjs +1 -1
  42. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  43. package/dist/crypto/CryptoProvider.mjs +1 -1
  44. package/dist/crypto/GuidGenerator.mjs +1 -1
  45. package/dist/crypto/HashUtils.mjs +1 -1
  46. package/dist/crypto/PkceGenerator.mjs +1 -1
  47. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  48. package/dist/error/ManagedIdentityError.mjs +1 -1
  49. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  50. package/dist/error/NodeAuthError.mjs +1 -1
  51. package/dist/index.mjs +1 -1
  52. package/dist/internals.mjs +1 -1
  53. package/dist/network/HttpClient.mjs +1 -1
  54. package/dist/network/HttpClientWithRetries.mjs +1 -1
  55. package/dist/network/LoopbackClient.mjs +1 -1
  56. package/dist/packageMetadata.d.ts +1 -1
  57. package/dist/packageMetadata.mjs +2 -2
  58. package/dist/protocol/Authorize.mjs +1 -1
  59. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  60. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  61. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  62. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  63. package/dist/utils/Constants.mjs +1 -1
  64. package/dist/utils/EncodingUtils.mjs +1 -1
  65. package/dist/utils/TimeUtils.mjs +1 -1
  66. package/lib/msal-node.cjs +159 -64
  67. package/lib/msal-node.cjs.map +1 -1
  68. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  69. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  70. package/lib/types/cache/serializer/SerializerTypes.d.ts +1 -0
  71. package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  72. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  73. package/lib/types/client/PublicClientApplication.d.ts +13 -1
  74. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  75. package/lib/types/config/Configuration.d.ts +4 -0
  76. package/lib/types/config/Configuration.d.ts.map +1 -1
  77. package/lib/types/packageMetadata.d.ts +1 -1
  78. package/package.json +2 -2
  79. package/src/cache/serializer/Deserializer.ts +1 -0
  80. package/src/cache/serializer/Serializer.ts +1 -0
  81. package/src/cache/serializer/SerializerTypes.ts +1 -0
  82. package/src/client/ClientApplication.ts +1 -0
  83. package/src/client/PublicClientApplication.ts +29 -0
  84. package/src/config/Configuration.ts +5 -0
  85. package/src/packageMetadata.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v5.0.6 2026-03-02 */
1
+ /*! @azure/msal-node v5.1.1 2026-03-18 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -93,6 +93,7 @@ class Serializer {
93
93
  key_id: atEntity.keyId,
94
94
  token_type: atEntity.tokenType,
95
95
  userAssertionHash: atEntity.userAssertionHash,
96
+ resource: atEntity.resource,
96
97
  };
97
98
  });
98
99
  return accessTokens;
@@ -149,7 +150,7 @@ class Serializer {
149
150
  }
150
151
  }
151
152
 
152
- /*! @azure/msal-common v16.2.0 2026-03-02 */
153
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
153
154
  /*
154
155
  * Copyright (c) Microsoft Corporation. All rights reserved.
155
156
  * Licensed under the MIT License.
@@ -397,7 +398,7 @@ const EncodingTypes = {
397
398
  UTF8: "utf-8",
398
399
  };
399
400
 
400
- /*! @azure/msal-common v16.2.0 2026-03-02 */
401
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
401
402
  /*
402
403
  * Copyright (c) Microsoft Corporation. All rights reserved.
403
404
  * Licensed under the MIT License.
@@ -446,9 +447,11 @@ const DOMAIN_HINT = "domain_hint";
446
447
  const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
447
448
  const BROKER_CLIENT_ID = "brk_client_id";
448
449
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
449
- const INSTANCE_AWARE = "instance_aware";
450
+ const INSTANCE_AWARE = "instance_aware";
451
+ const RESOURCE = "resource";
452
+ const CLI_DATA = "clidata";
450
453
 
451
- /*! @azure/msal-common v16.2.0 2026-03-02 */
454
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
452
455
  /*
453
456
  * Copyright (c) Microsoft Corporation. All rights reserved.
454
457
  * Licensed under the MIT License.
@@ -479,7 +482,7 @@ function createAuthError(code, additionalMessage) {
479
482
  return new AuthError(code, additionalMessage || getDefaultErrorMessage(code));
480
483
  }
481
484
 
482
- /*! @azure/msal-common v16.2.0 2026-03-02 */
485
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
483
486
 
484
487
  /*
485
488
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -499,7 +502,7 @@ function createClientConfigurationError(errorCode) {
499
502
  return new ClientConfigurationError(errorCode);
500
503
  }
501
504
 
502
- /*! @azure/msal-common v16.2.0 2026-03-02 */
505
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
503
506
  /*
504
507
  * Copyright (c) Microsoft Corporation. All rights reserved.
505
508
  * Licensed under the MIT License.
@@ -579,7 +582,7 @@ class StringUtils {
579
582
  }
580
583
  }
581
584
 
582
- /*! @azure/msal-common v16.2.0 2026-03-02 */
585
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
583
586
 
584
587
  /*
585
588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -602,7 +605,7 @@ function createClientAuthError(errorCode, additionalMessage) {
602
605
  return new ClientAuthError(errorCode, additionalMessage);
603
606
  }
604
607
 
605
- /*! @azure/msal-common v16.2.0 2026-03-02 */
608
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
606
609
  /*
607
610
  * Copyright (c) Microsoft Corporation. All rights reserved.
608
611
  * Licensed under the MIT License.
@@ -656,7 +659,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
656
659
  urlParseError: urlParseError
657
660
  });
658
661
 
659
- /*! @azure/msal-common v16.2.0 2026-03-02 */
662
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
660
663
  /*
661
664
  * Copyright (c) Microsoft Corporation. All rights reserved.
662
665
  * Licensed under the MIT License.
@@ -697,7 +700,9 @@ const noNetworkConnectivity = "no_network_connectivity";
697
700
  const userCanceled = "user_canceled";
698
701
  const methodNotImplemented = "method_not_implemented";
699
702
  const nestedAppAuthBridgeDisabled = "nested_app_auth_bridge_disabled";
700
- const platformBrokerError = "platform_broker_error";
703
+ const platformBrokerError = "platform_broker_error";
704
+ const resourceParameterRequired = "resource_parameter_required";
705
+ const misplacedResourceParam = "misplaced_resource_parameter";
701
706
 
702
707
  var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
703
708
  __proto__: null,
@@ -718,6 +723,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
718
723
  keyIdMissing: keyIdMissing,
719
724
  maxAgeTranspired: maxAgeTranspired,
720
725
  methodNotImplemented: methodNotImplemented,
726
+ misplacedResourceParam: misplacedResourceParam,
721
727
  multipleMatchingAppMetadata: multipleMatchingAppMetadata,
722
728
  multipleMatchingTokens: multipleMatchingTokens,
723
729
  nestedAppAuthBridgeDisabled: nestedAppAuthBridgeDisabled,
@@ -731,6 +737,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
731
737
  openIdConfigError: openIdConfigError,
732
738
  platformBrokerError: platformBrokerError,
733
739
  requestCannotBeMade: requestCannotBeMade,
740
+ resourceParameterRequired: resourceParameterRequired,
734
741
  stateMismatch: stateMismatch,
735
742
  stateNotFound: stateNotFound,
736
743
  tokenClaimsCnfRequiredForSignedJwt: tokenClaimsCnfRequiredForSignedJwt,
@@ -740,7 +747,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
740
747
  userCanceled: userCanceled
741
748
  });
742
749
 
743
- /*! @azure/msal-common v16.2.0 2026-03-02 */
750
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
744
751
 
745
752
  /*
746
753
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -935,7 +942,7 @@ class ScopeSet {
935
942
  }
936
943
  }
937
944
 
938
- /*! @azure/msal-common v16.2.0 2026-03-02 */
945
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
939
946
 
940
947
  /*
941
948
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1216,6 +1223,12 @@ function addGrantType(parameters, grantType) {
1216
1223
  function addClientInfo(parameters) {
1217
1224
  parameters.set(CLIENT_INFO, "1");
1218
1225
  }
1226
+ /**
1227
+ * add clidata=1 to request to indicate client data support
1228
+ */
1229
+ function addCliData(parameters) {
1230
+ parameters.set(CLI_DATA, "1");
1231
+ }
1219
1232
  function addInstanceAware(parameters) {
1220
1233
  if (!parameters.has(INSTANCE_AWARE)) {
1221
1234
  parameters.set(INSTANCE_AWARE, "true");
@@ -1318,9 +1331,14 @@ function addBrokerParameters(parameters, brokerClientId, brokerRedirectUri) {
1318
1331
  if (!parameters.has(BROKER_REDIRECT_URI)) {
1319
1332
  parameters.set(BROKER_REDIRECT_URI, brokerRedirectUri);
1320
1333
  }
1334
+ }
1335
+ function addResource(parameters, resource) {
1336
+ if (resource) {
1337
+ parameters.set(RESOURCE, resource);
1338
+ }
1321
1339
  }
1322
1340
 
1323
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1341
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1324
1342
  /**
1325
1343
  * Parses hash string from given string. Returns empty string if no hash symbol is found.
1326
1344
  * @param hashString
@@ -1373,7 +1391,7 @@ function mapToQueryString(parameters) {
1373
1391
  return queryParameterArray.join("&");
1374
1392
  }
1375
1393
 
1376
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1394
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1377
1395
 
1378
1396
  /*
1379
1397
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1412,7 +1430,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
1412
1430
  },
1413
1431
  };
1414
1432
 
1415
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1433
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1416
1434
  /*
1417
1435
  * Copyright (c) Microsoft Corporation. All rights reserved.
1418
1436
  * Licensed under the MIT License.
@@ -1673,12 +1691,12 @@ class Logger {
1673
1691
  }
1674
1692
  }
1675
1693
 
1676
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1694
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1677
1695
  /* eslint-disable header/header */
1678
1696
  const name$1 = "@azure/msal-common";
1679
- const version$1 = "16.2.0";
1697
+ const version$1 = "16.4.0";
1680
1698
 
1681
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1699
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1682
1700
  /*
1683
1701
  * Copyright (c) Microsoft Corporation. All rights reserved.
1684
1702
  * Licensed under the MIT License.
@@ -1698,7 +1716,7 @@ const AzureCloudInstance = {
1698
1716
  AzureUsGovernment: "https://login.microsoftonline.us",
1699
1717
  };
1700
1718
 
1701
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1719
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1702
1720
  /*
1703
1721
  * Copyright (c) Microsoft Corporation. All rights reserved.
1704
1722
  * Licensed under the MIT License.
@@ -1780,7 +1798,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1780
1798
  return updatedAccountInfo;
1781
1799
  }
1782
1800
 
1783
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1801
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1784
1802
 
1785
1803
  /*
1786
1804
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1860,7 +1878,7 @@ function checkMaxAge(authTime, maxAge) {
1860
1878
  }
1861
1879
  }
1862
1880
 
1863
- /*! @azure/msal-common v16.2.0 2026-03-02 */
1881
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
1864
1882
 
1865
1883
  /*
1866
1884
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2017,7 +2035,7 @@ class UrlString {
2017
2035
  }
2018
2036
  }
2019
2037
 
2020
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2038
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2021
2039
 
2022
2040
  /*
2023
2041
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2174,7 +2192,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2174
2192
  return null;
2175
2193
  }
2176
2194
 
2177
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2195
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2178
2196
  /*
2179
2197
  * Copyright (c) Microsoft Corporation. All rights reserved.
2180
2198
  * Licensed under the MIT License.
@@ -2182,7 +2200,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2182
2200
  const cacheQuotaExceeded = "cache_quota_exceeded";
2183
2201
  const cacheErrorUnknown = "cache_error_unknown";
2184
2202
 
2185
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2203
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2186
2204
 
2187
2205
  /*
2188
2206
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2220,7 +2238,7 @@ function createCacheError(e) {
2220
2238
  }
2221
2239
  }
2222
2240
 
2223
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2241
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2224
2242
 
2225
2243
  /*
2226
2244
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2258,7 +2276,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2258
2276
  };
2259
2277
  }
2260
2278
 
2261
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2279
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2262
2280
  /*
2263
2281
  * Copyright (c) Microsoft Corporation. All rights reserved.
2264
2282
  * Licensed under the MIT License.
@@ -2273,7 +2291,7 @@ const AuthorityType = {
2273
2291
  Ciam: 3,
2274
2292
  };
2275
2293
 
2276
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2294
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2277
2295
  /*
2278
2296
  * Copyright (c) Microsoft Corporation. All rights reserved.
2279
2297
  * Licensed under the MIT License.
@@ -2295,7 +2313,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2295
2313
  return null;
2296
2314
  }
2297
2315
 
2298
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2316
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2299
2317
  /*
2300
2318
  * Copyright (c) Microsoft Corporation. All rights reserved.
2301
2319
  * Licensed under the MIT License.
@@ -2319,7 +2337,7 @@ const ProtocolMode = {
2319
2337
  EAR: "EAR",
2320
2338
  };
2321
2339
 
2322
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2340
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2323
2341
  /**
2324
2342
  * Returns the AccountInfo interface for this account.
2325
2343
  */
@@ -2462,7 +2480,7 @@ function isAccountEntity(entity) {
2462
2480
  entity.hasOwnProperty("authorityType"));
2463
2481
  }
2464
2482
 
2465
- /*! @azure/msal-common v16.2.0 2026-03-02 */
2483
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
2466
2484
 
2467
2485
  /*
2468
2486
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2492,6 +2510,11 @@ class CacheManager {
2492
2510
  * Gets first tenanted AccountInfo object found based on provided filters
2493
2511
  */
2494
2512
  getAccountInfoFilteredBy(accountFilter, correlationId) {
2513
+ if (Object.keys(accountFilter).length === 0 ||
2514
+ Object.values(accountFilter).every((value) => value === null || value === undefined || value === "")) {
2515
+ this.commonLogger.warning("getAccountInfoFilteredBy: Account filter is empty or invalid, returning null", correlationId);
2516
+ return null;
2517
+ }
2495
2518
  const allAccounts = this.getAllAccounts(accountFilter, correlationId);
2496
2519
  if (allAccounts.length > 1) {
2497
2520
  // If one or more accounts are found, prioritize accounts that have an ID token
@@ -3558,7 +3581,7 @@ class DefaultStorageClass extends CacheManager {
3558
3581
  }
3559
3582
  }
3560
3583
 
3561
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3584
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3562
3585
  /*
3563
3586
  * Copyright (c) Microsoft Corporation. All rights reserved.
3564
3587
  * Licensed under the MIT License.
@@ -3572,7 +3595,7 @@ class DefaultStorageClass extends CacheManager {
3572
3595
  const PerformanceEventStatus = {
3573
3596
  InProgress: 1};
3574
3597
 
3575
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3598
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3576
3599
 
3577
3600
  /*
3578
3601
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3627,7 +3650,7 @@ class StubPerformanceClient {
3627
3650
  }
3628
3651
  }
3629
3652
 
3630
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3653
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3631
3654
 
3632
3655
  /*
3633
3656
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3710,6 +3733,7 @@ function buildAuthOptions(authOptions) {
3710
3733
  clientCapabilities: [],
3711
3734
  azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS,
3712
3735
  instanceAware: false,
3736
+ isMcp: false,
3713
3737
  ...authOptions,
3714
3738
  };
3715
3739
  }
@@ -3721,7 +3745,7 @@ function isOidcProtocolMode(config) {
3721
3745
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3722
3746
  }
3723
3747
 
3724
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3748
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3725
3749
 
3726
3750
  /*
3727
3751
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3740,7 +3764,7 @@ class ServerError extends AuthError {
3740
3764
  }
3741
3765
  }
3742
3766
 
3743
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3767
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3744
3768
  /*
3745
3769
  * Copyright (c) Microsoft Corporation. All rights reserved.
3746
3770
  * Licensed under the MIT License.
@@ -3804,7 +3828,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
3804
3828
  uxNotAllowed: uxNotAllowed
3805
3829
  });
3806
3830
 
3807
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3831
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3808
3832
 
3809
3833
  /*
3810
3834
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3872,7 +3896,7 @@ function createInteractionRequiredAuthError(errorCode, errorMessage) {
3872
3896
  return new InteractionRequiredAuthError(errorCode, errorMessage);
3873
3897
  }
3874
3898
 
3875
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3899
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3876
3900
  /**
3877
3901
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
3878
3902
  * @param base64Decode
@@ -3904,7 +3928,7 @@ function parseRequestState(base64Decode, state) {
3904
3928
  }
3905
3929
  }
3906
3930
 
3907
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3931
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3908
3932
  /*
3909
3933
  * Copyright (c) Microsoft Corporation. All rights reserved.
3910
3934
  * Licensed under the MIT License.
@@ -3959,7 +3983,7 @@ function delay(t, value) {
3959
3983
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
3960
3984
  }
3961
3985
 
3962
- /*! @azure/msal-common v16.2.0 2026-03-02 */
3986
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
3963
3987
  /*
3964
3988
  * Copyright (c) Microsoft Corporation. All rights reserved.
3965
3989
  * Licensed under the MIT License.
@@ -4021,7 +4045,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
4021
4045
  */
4022
4046
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
4023
4047
 
4024
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4048
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4025
4049
  /*
4026
4050
  * Copyright (c) Microsoft Corporation. All rights reserved.
4027
4051
  * Licensed under the MIT License.
@@ -4114,7 +4138,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4114
4138
  };
4115
4139
  };
4116
4140
 
4117
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4141
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4118
4142
 
4119
4143
  /*
4120
4144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4194,7 +4218,7 @@ class PopTokenGenerator {
4194
4218
  }
4195
4219
  }
4196
4220
 
4197
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4221
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4198
4222
  /*
4199
4223
  * Copyright (c) Microsoft Corporation. All rights reserved.
4200
4224
  * Licensed under the MIT License.
@@ -4221,7 +4245,7 @@ class PopTokenGenerator {
4221
4245
  }
4222
4246
  }
4223
4247
 
4224
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4248
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4225
4249
 
4226
4250
  /*
4227
4251
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4480,7 +4504,7 @@ function isAuthorityMetadataExpired(metadata) {
4480
4504
  return metadata.expiresAt <= nowSeconds();
4481
4505
  }
4482
4506
 
4483
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4507
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4484
4508
 
4485
4509
  /*
4486
4510
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4665,6 +4689,11 @@ class ResponseHandler {
4665
4689
  : undefined;
4666
4690
  // non AAD scenarios can have empty realm
4667
4691
  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);
4692
+ // Set resource (to be used for MCP scenarios)
4693
+ const resource = request.resource || null;
4694
+ if (resource) {
4695
+ cachedAccessToken.resource = resource;
4696
+ }
4668
4697
  }
4669
4698
  // refreshToken
4670
4699
  let cachedRefreshToken = null;
@@ -4816,7 +4845,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
4816
4845
  return baseAccount;
4817
4846
  }
4818
4847
 
4819
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4848
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4820
4849
  /*
4821
4850
  * Copyright (c) Microsoft Corporation. All rights reserved.
4822
4851
  * Licensed under the MIT License.
@@ -4826,7 +4855,7 @@ const CcsCredentialType = {
4826
4855
  UPN: "UPN",
4827
4856
  };
4828
4857
 
4829
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4858
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4830
4859
  /*
4831
4860
  * Copyright (c) Microsoft Corporation. All rights reserved.
4832
4861
  * Licensed under the MIT License.
@@ -4844,7 +4873,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
4844
4873
  }
4845
4874
  }
4846
4875
 
4847
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4876
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4848
4877
  /*
4849
4878
  * Copyright (c) Microsoft Corporation. All rights reserved.
4850
4879
  * Licensed under the MIT License.
@@ -4865,7 +4894,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
4865
4894
  };
4866
4895
  }
4867
4896
 
4868
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4897
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4869
4898
 
4870
4899
  /*
4871
4900
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4951,7 +4980,7 @@ class ThrottlingUtils {
4951
4980
  }
4952
4981
  }
4953
4982
 
4954
- /*! @azure/msal-common v16.2.0 2026-03-02 */
4983
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4955
4984
 
4956
4985
  /*
4957
4986
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4982,7 +5011,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
4982
5011
  return new NetworkError(error, httpStatus, responseHeaders);
4983
5012
  }
4984
5013
 
4985
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5014
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
4986
5015
 
4987
5016
  /*
4988
5017
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5096,7 +5125,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
5096
5125
  return response;
5097
5126
  }
5098
5127
 
5099
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5128
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
5100
5129
  /*
5101
5130
  * Copyright (c) Microsoft Corporation. All rights reserved.
5102
5131
  * Licensed under the MIT License.
@@ -5108,7 +5137,7 @@ function isOpenIdConfigResponse(response) {
5108
5137
  response.hasOwnProperty("jwks_uri"));
5109
5138
  }
5110
5139
 
5111
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5140
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
5112
5141
  /*
5113
5142
  * Copyright (c) Microsoft Corporation. All rights reserved.
5114
5143
  * Licensed under the MIT License.
@@ -5118,7 +5147,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5118
5147
  response.hasOwnProperty("metadata"));
5119
5148
  }
5120
5149
 
5121
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5150
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
5122
5151
  /*
5123
5152
  * Copyright (c) Microsoft Corporation. All rights reserved.
5124
5153
  * Licensed under the MIT License.
@@ -5128,7 +5157,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
5128
5157
  response.hasOwnProperty("error_description"));
5129
5158
  }
5130
5159
 
5131
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5160
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
5132
5161
 
5133
5162
  /*
5134
5163
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5233,7 +5262,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5233
5262
  },
5234
5263
  };
5235
5264
 
5236
- /*! @azure/msal-common v16.2.0 2026-03-02 */
5265
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
5237
5266
 
5238
5267
  /*
5239
5268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6056,7 +6085,7 @@ function buildStaticAuthorityOptions(authOptions) {
6056
6085
  };
6057
6086
  }
6058
6087
 
6059
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6088
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6060
6089
 
6061
6090
  /*
6062
6091
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6090,7 +6119,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6090
6119
  }
6091
6120
  }
6092
6121
 
6093
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6122
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6094
6123
 
6095
6124
  /*
6096
6125
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6210,6 +6239,7 @@ class AuthorizationCodeClient {
6210
6239
  }
6211
6240
  // Add scope array, parameter builder will add default scopes and dedupe
6212
6241
  addScopes(parameters, request.scopes, true, this.oidcDefaultScopes);
6242
+ addResource(parameters, request.resource);
6213
6243
  // add code: user set, not validated
6214
6244
  addAuthorizationCode(parameters, request.code);
6215
6245
  // Add library metadata
@@ -6350,7 +6380,7 @@ class AuthorizationCodeClient {
6350
6380
  }
6351
6381
  }
6352
6382
 
6353
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6383
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6354
6384
 
6355
6385
  /*
6356
6386
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6575,7 +6605,7 @@ class RefreshTokenClient {
6575
6605
  }
6576
6606
  }
6577
6607
 
6578
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6608
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6579
6609
 
6580
6610
  /*
6581
6611
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6631,6 +6661,13 @@ class SilentFlowClient {
6631
6661
  this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);
6632
6662
  throw createClientAuthError(tokenRefreshRequired);
6633
6663
  }
6664
+ else if (request.resource) {
6665
+ // cached access token must have a resource that matches the request resource for MCP scenarios
6666
+ if (cachedAccessToken.resource !== request.resource) {
6667
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
6668
+ throw createClientAuthError(tokenRefreshRequired);
6669
+ }
6670
+ }
6634
6671
  else if (cachedAccessToken.refreshOn &&
6635
6672
  isTokenExpired(cachedAccessToken.refreshOn, 0)) {
6636
6673
  // must refresh (in the background) due to the refresh_in value
@@ -6684,7 +6721,7 @@ class SilentFlowClient {
6684
6721
  }
6685
6722
  }
6686
6723
 
6687
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6724
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6688
6725
 
6689
6726
  /*
6690
6727
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6710,12 +6747,15 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
6710
6747
  ...(request.extraScopesToConsent || []),
6711
6748
  ];
6712
6749
  addScopes(parameters, requestScopes, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
6750
+ addResource(parameters, request.resource);
6713
6751
  addRedirectUri(parameters, request.redirectUri);
6714
6752
  addCorrelationId(parameters, correlationId);
6715
6753
  // add response_mode. If not passed in it defaults to query.
6716
6754
  addResponseMode(parameters, request.responseMode);
6717
6755
  // add client_info=1
6718
6756
  addClientInfo(parameters);
6757
+ // add clidata=1
6758
+ addCliData(parameters);
6719
6759
  if (request.prompt) {
6720
6760
  addPrompt(parameters, request.prompt);
6721
6761
  }
@@ -6834,7 +6874,40 @@ function extractLoginHint(account) {
6834
6874
  return account.loginHint || account.idTokenClaims?.login_hint || null;
6835
6875
  }
6836
6876
 
6837
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6877
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6878
+
6879
+ /*
6880
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6881
+ * Licensed under the MIT License.
6882
+ */
6883
+ /**
6884
+ * Helper to enforce resource parameter presence in token requests when isMcp is set in the configuration.
6885
+ * If resource parameter is set in both the request and in extraQueryParameters or extraParameters, an error will be thrown.
6886
+ * This is used for MCP flows.
6887
+ * @param isMcp - Flag indicating if application is an MCP app, from configuration
6888
+ * @param request - Auth request
6889
+ */
6890
+ function enforceResourceParameter(isMcp, request) {
6891
+ if (!isMcp) {
6892
+ return;
6893
+ }
6894
+ if (request.resource &&
6895
+ (containsResourceParam(request.extraParameters) ||
6896
+ containsResourceParam(request.extraQueryParameters))) {
6897
+ throw createClientAuthError(misplacedResourceParam);
6898
+ }
6899
+ if (!request.resource) {
6900
+ throw createClientAuthError(resourceParameterRequired);
6901
+ }
6902
+ }
6903
+ function containsResourceParam(params) {
6904
+ if (!params) {
6905
+ return false;
6906
+ }
6907
+ return Object.prototype.hasOwnProperty.call(params, "resource");
6908
+ }
6909
+
6910
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6838
6911
  /*
6839
6912
  * Copyright (c) Microsoft Corporation. All rights reserved.
6840
6913
  * Licensed under the MIT License.
@@ -6851,7 +6924,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
6851
6924
  unexpectedError: unexpectedError
6852
6925
  });
6853
6926
 
6854
- /*! @azure/msal-common v16.2.0 2026-03-02 */
6927
+ /*! @azure/msal-common v16.4.0 2026-03-18 */
6855
6928
 
6856
6929
  /*
6857
6930
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7208,6 +7281,7 @@ class Deserializer {
7208
7281
  keyId: serializedAT.key_id,
7209
7282
  tokenType: serializedAT.token_type,
7210
7283
  userAssertionHash: serializedAT.userAssertionHash,
7284
+ resource: serializedAT.resource,
7211
7285
  lastUpdatedAt: Date.now().toString(),
7212
7286
  };
7213
7287
  atObjects[key] = accessToken;
@@ -7851,6 +7925,7 @@ const DEFAULT_AUTH_OPTIONS = {
7851
7925
  azureCloudInstance: AzureCloudInstance.None,
7852
7926
  tenant: "",
7853
7927
  },
7928
+ isMcp: false,
7854
7929
  };
7855
7930
  const DEFAULT_LOGGER_OPTIONS = {
7856
7931
  loggerCallback: () => {
@@ -9052,7 +9127,7 @@ class ClientAssertion {
9052
9127
 
9053
9128
  /* eslint-disable header/header */
9054
9129
  const name = "@azure/msal-node";
9055
- const version = "5.0.6";
9130
+ const version = "5.1.1";
9056
9131
 
9057
9132
  /*
9058
9133
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9505,6 +9580,7 @@ class ClientApplication {
9505
9580
  authority: discoveredAuthority,
9506
9581
  clientCapabilities: this.config.auth.clientCapabilities,
9507
9582
  redirectUri,
9583
+ isMcp: this.config.auth.isMcp,
9508
9584
  },
9509
9585
  loggerOptions: {
9510
9586
  logLevel: this.config.system.loggerOptions.logLevel,
@@ -9956,6 +10032,7 @@ class PublicClientApplication extends ClientApplication {
9956
10032
  */
9957
10033
  async acquireTokenByDeviceCode(request) {
9958
10034
  this.logger.info("acquireTokenByDeviceCode called", request.correlationId || "");
10035
+ enforceResourceParameter(this.config.auth.isMcp, request);
9959
10036
  const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
9960
10037
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
9961
10038
  try {
@@ -9979,6 +10056,7 @@ class PublicClientApplication extends ClientApplication {
9979
10056
  async acquireTokenInteractive(request) {
9980
10057
  const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
9981
10058
  this.logger.trace("acquireTokenInteractive called", correlationId);
10059
+ enforceResourceParameter(this.config.auth.isMcp, request);
9982
10060
  const { openBrowser, successTemplate, errorTemplate, windowHandle, loopbackClient: customLoopbackClient, ...remainingProperties } = request;
9983
10061
  if (this.nativeBrokerPlugin) {
9984
10062
  const brokerRequest = {
@@ -10063,6 +10141,7 @@ class PublicClientApplication extends ClientApplication {
10063
10141
  async acquireTokenSilent(request) {
10064
10142
  const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
10065
10143
  this.logger.trace("acquireTokenSilent called", correlationId);
10144
+ enforceResourceParameter(this.config.auth.isMcp, request);
10066
10145
  if (this.nativeBrokerPlugin) {
10067
10146
  const brokerRequest = {
10068
10147
  ...request,
@@ -10090,6 +10169,22 @@ class PublicClientApplication extends ClientApplication {
10090
10169
  }
10091
10170
  return super.acquireTokenSilent(request);
10092
10171
  }
10172
+ /**
10173
+ * Acquires a token by exchanging the authorization code received from the first step of OAuth 2.0 Authorization Code Flow.
10174
+ * In MCP mode, a resource parameter is required on the request.
10175
+ */
10176
+ async acquireTokenByCode(request, authCodePayLoad) {
10177
+ enforceResourceParameter(this.config.auth.isMcp, request);
10178
+ return super.acquireTokenByCode(request, authCodePayLoad);
10179
+ }
10180
+ /**
10181
+ * Acquires a token by exchanging the refresh token provided for a new set of tokens.
10182
+ * In MCP mode, a resource parameter is required on the request.
10183
+ */
10184
+ async acquireTokenByRefreshToken(request) {
10185
+ enforceResourceParameter(this.config.auth.isMcp, request);
10186
+ return super.acquireTokenByRefreshToken(request);
10187
+ }
10093
10188
  /**
10094
10189
  * Removes cache artifacts associated with the given account
10095
10190
  * @param request - developer provided SignOutRequest