@azure/msal-browser 3.17.0 → 3.18.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 (87) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AccountManager.mjs +1 -1
  7. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  8. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  9. package/dist/cache/BrowserCacheManager.mjs +6 -3
  10. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  11. package/dist/cache/BrowserStorage.mjs +1 -1
  12. package/dist/cache/DatabaseStorage.mjs +1 -1
  13. package/dist/cache/MemoryStorage.mjs +1 -1
  14. package/dist/cache/TokenCache.d.ts.map +1 -1
  15. package/dist/cache/TokenCache.mjs +90 -117
  16. package/dist/cache/TokenCache.mjs.map +1 -1
  17. package/dist/config/Configuration.mjs +1 -1
  18. package/dist/controllers/ControllerFactory.mjs +1 -1
  19. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  20. package/dist/controllers/StandardController.d.ts.map +1 -1
  21. package/dist/controllers/StandardController.mjs +4 -3
  22. package/dist/controllers/StandardController.mjs.map +1 -1
  23. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  24. package/dist/crypto/BrowserCrypto.mjs +1 -1
  25. package/dist/crypto/CryptoOps.mjs +1 -1
  26. package/dist/crypto/PkceGenerator.mjs +1 -1
  27. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  28. package/dist/encode/Base64Decode.mjs +1 -1
  29. package/dist/encode/Base64Encode.mjs +1 -1
  30. package/dist/error/BrowserAuthError.mjs +1 -1
  31. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  32. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  33. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  34. package/dist/error/NativeAuthError.mjs +1 -1
  35. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  36. package/dist/error/NestedAppAuthError.mjs +2 -2
  37. package/dist/error/NestedAppAuthError.mjs.map +1 -1
  38. package/dist/event/EventHandler.mjs +1 -1
  39. package/dist/event/EventMessage.mjs +1 -1
  40. package/dist/event/EventType.mjs +1 -1
  41. package/dist/index.mjs +1 -1
  42. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  43. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  44. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  45. package/dist/interaction_client/NativeInteractionClient.mjs +7 -4
  46. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  47. package/dist/interaction_client/PopupClient.mjs +1 -1
  48. package/dist/interaction_client/RedirectClient.mjs +1 -1
  49. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  50. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  51. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  52. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  53. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  54. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  55. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  56. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  57. package/dist/naa/BridgeError.mjs +1 -1
  58. package/dist/naa/BridgeProxy.mjs +1 -1
  59. package/dist/naa/BridgeStatusCode.mjs +1 -1
  60. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  61. package/dist/navigation/NavigationClient.mjs +1 -1
  62. package/dist/network/FetchClient.mjs +1 -1
  63. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  64. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  65. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  66. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  67. package/dist/packageMetadata.d.ts +1 -1
  68. package/dist/packageMetadata.mjs +2 -2
  69. package/dist/request/RequestHelpers.mjs +1 -1
  70. package/dist/response/ResponseHandler.mjs +1 -1
  71. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  72. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  73. package/dist/utils/BrowserConstants.mjs +1 -1
  74. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  75. package/dist/utils/BrowserUtils.mjs +1 -1
  76. package/lib/msal-browser.cjs +190 -233
  77. package/lib/msal-browser.cjs.map +1 -1
  78. package/lib/msal-browser.js +190 -233
  79. package/lib/msal-browser.js.map +1 -1
  80. package/lib/msal-browser.min.js +63 -64
  81. package/package.json +3 -2
  82. package/src/cache/BrowserCacheManager.ts +4 -5
  83. package/src/cache/TokenCache.ts +158 -243
  84. package/src/controllers/StandardController.ts +6 -5
  85. package/src/error/NestedAppAuthError.ts +1 -1
  86. package/src/interaction_client/NativeInteractionClient.ts +5 -7
  87. package/src/packageMetadata.ts +1 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v3.17.0 2024-06-10 */
1
+ /*! @azure/msal-browser v3.18.0 2024-07-01 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -48,6 +48,7 @@ const Constants = {
48
48
  NOT_DEFINED: "not_defined",
49
49
  EMPTY_STRING: "",
50
50
  NOT_APPLICABLE: "N/A",
51
+ NOT_AVAILABLE: "Not Available",
51
52
  FORWARD_SLASH: "/",
52
53
  IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
53
54
  IMDS_VERSION: "2020-06-01",
@@ -310,7 +311,7 @@ const JsonWebTokenTypes = {
310
311
  // Token renewal offset default in seconds
311
312
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
312
313
 
313
- /*! @azure/msal-common v14.12.0 2024-06-10 */
314
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
314
315
  /*
315
316
  * Copyright (c) Microsoft Corporation. All rights reserved.
316
317
  * Licensed under the MIT License.
@@ -327,7 +328,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
327
328
  unexpectedError: unexpectedError
328
329
  });
329
330
 
330
- /*! @azure/msal-common v14.12.0 2024-06-10 */
331
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
331
332
 
332
333
  /*
333
334
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -376,7 +377,7 @@ function createAuthError(code, additionalMessage) {
376
377
  : AuthErrorMessages[code]);
377
378
  }
378
379
 
379
- /*! @azure/msal-common v14.12.0 2024-06-10 */
380
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
380
381
  /*
381
382
  * Copyright (c) Microsoft Corporation. All rights reserved.
382
383
  * Licensed under the MIT License.
@@ -474,7 +475,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
474
475
  userTimeoutReached: userTimeoutReached
475
476
  });
476
477
 
477
- /*! @azure/msal-common v14.12.0 2024-06-10 */
478
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
478
479
 
479
480
  /*
480
481
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -726,7 +727,7 @@ function createClientAuthError(errorCode, additionalMessage) {
726
727
  return new ClientAuthError(errorCode, additionalMessage);
727
728
  }
728
729
 
729
- /*! @azure/msal-common v14.12.0 2024-06-10 */
730
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
730
731
 
731
732
  /*
732
733
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -787,7 +788,7 @@ function checkMaxAge(authTime, maxAge) {
787
788
  }
788
789
  }
789
790
 
790
- /*! @azure/msal-common v14.12.0 2024-06-10 */
791
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
791
792
  /*
792
793
  * Copyright (c) Microsoft Corporation. All rights reserved.
793
794
  * Licensed under the MIT License.
@@ -802,7 +803,7 @@ const AuthorityType = {
802
803
  Ciam: 3,
803
804
  };
804
805
 
805
- /*! @azure/msal-common v14.12.0 2024-06-10 */
806
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
806
807
  /*
807
808
  * Copyright (c) Microsoft Corporation. All rights reserved.
808
809
  * Licensed under the MIT License.
@@ -814,7 +815,7 @@ function isOpenIdConfigResponse(response) {
814
815
  response.hasOwnProperty("jwks_uri"));
815
816
  }
816
817
 
817
- /*! @azure/msal-common v14.12.0 2024-06-10 */
818
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
818
819
  /*
819
820
  * Copyright (c) Microsoft Corporation. All rights reserved.
820
821
  * Licensed under the MIT License.
@@ -868,7 +869,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
868
869
  urlParseError: urlParseError
869
870
  });
870
871
 
871
- /*! @azure/msal-common v14.12.0 2024-06-10 */
872
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
872
873
 
873
874
  /*
874
875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1006,7 +1007,7 @@ function createClientConfigurationError(errorCode) {
1006
1007
  return new ClientConfigurationError(errorCode);
1007
1008
  }
1008
1009
 
1009
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1010
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1010
1011
  /*
1011
1012
  * Copyright (c) Microsoft Corporation. All rights reserved.
1012
1013
  * Licensed under the MIT License.
@@ -1103,7 +1104,7 @@ class StringUtils {
1103
1104
  }
1104
1105
  }
1105
1106
 
1106
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1107
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1107
1108
 
1108
1109
  /*
1109
1110
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1150,7 +1151,7 @@ function getDeserializedResponse(responseString) {
1150
1151
  return null;
1151
1152
  }
1152
1153
 
1153
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1154
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1154
1155
 
1155
1156
  /*
1156
1157
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1314,7 +1315,7 @@ class UrlString {
1314
1315
  }
1315
1316
  }
1316
1317
 
1317
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1318
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1318
1319
 
1319
1320
  /*
1320
1321
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1454,7 +1455,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1454
1455
  return null;
1455
1456
  }
1456
1457
 
1457
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1458
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1458
1459
  /*
1459
1460
  * Copyright (c) Microsoft Corporation. All rights reserved.
1460
1461
  * Licensed under the MIT License.
@@ -1467,7 +1468,7 @@ const ProtocolMode = {
1467
1468
  OIDC: "OIDC",
1468
1469
  };
1469
1470
 
1470
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1471
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1471
1472
  /*
1472
1473
  * Copyright (c) Microsoft Corporation. All rights reserved.
1473
1474
  * Licensed under the MIT License.
@@ -1487,7 +1488,7 @@ const AzureCloudInstance = {
1487
1488
  AzureUsGovernment: "https://login.microsoftonline.us",
1488
1489
  };
1489
1490
 
1490
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1491
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1491
1492
  /*
1492
1493
  * Copyright (c) Microsoft Corporation. All rights reserved.
1493
1494
  * Licensed under the MIT License.
@@ -1497,7 +1498,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1497
1498
  response.hasOwnProperty("metadata"));
1498
1499
  }
1499
1500
 
1500
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1501
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1501
1502
  /*
1502
1503
  * Copyright (c) Microsoft Corporation. All rights reserved.
1503
1504
  * Licensed under the MIT License.
@@ -1507,7 +1508,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1507
1508
  response.hasOwnProperty("error_description"));
1508
1509
  }
1509
1510
 
1510
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1511
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1511
1512
  /*
1512
1513
  * Copyright (c) Microsoft Corporation. All rights reserved.
1513
1514
  * Licensed under the MIT License.
@@ -1989,7 +1990,7 @@ const IntFields = new Set([
1989
1990
  "multiMatchedRT",
1990
1991
  ]);
1991
1992
 
1992
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1993
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
1993
1994
  /*
1994
1995
  * Copyright (c) Microsoft Corporation. All rights reserved.
1995
1996
  * Licensed under the MIT License.
@@ -2085,7 +2086,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
2085
2086
  };
2086
2087
  };
2087
2088
 
2088
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2089
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2089
2090
 
2090
2091
  /*
2091
2092
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2194,7 +2195,7 @@ RegionDiscovery.IMDS_OPTIONS = {
2194
2195
  },
2195
2196
  };
2196
2197
 
2197
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2198
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2198
2199
  /*
2199
2200
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2201
  * Licensed under the MIT License.
@@ -2231,7 +2232,7 @@ function wasClockTurnedBack(cachedAt) {
2231
2232
  return cachedAtSec > nowSeconds();
2232
2233
  }
2233
2234
 
2234
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2235
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2235
2236
 
2236
2237
  /*
2237
2238
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2558,7 +2559,7 @@ function isAuthorityMetadataExpired(metadata) {
2558
2559
  return metadata.expiresAt <= nowSeconds();
2559
2560
  }
2560
2561
 
2561
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2562
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
2562
2563
 
2563
2564
  /*
2564
2565
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3397,7 +3398,7 @@ function buildStaticAuthorityOptions(authOptions) {
3397
3398
  };
3398
3399
  }
3399
3400
 
3400
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3401
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3401
3402
 
3402
3403
  /*
3403
3404
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3428,7 +3429,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3428
3429
  }
3429
3430
  }
3430
3431
 
3431
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3432
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3432
3433
  /*
3433
3434
  * Copyright (c) Microsoft Corporation. All rights reserved.
3434
3435
  * Licensed under the MIT License.
@@ -3446,7 +3447,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
3446
3447
  }
3447
3448
  }
3448
3449
 
3449
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3450
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3450
3451
  /*
3451
3452
  * Copyright (c) Microsoft Corporation. All rights reserved.
3452
3453
  * Licensed under the MIT License.
@@ -3493,7 +3494,7 @@ const SID = "sid";
3493
3494
  const LOGIN_HINT = "login_hint";
3494
3495
  const DOMAIN_HINT = "domain_hint";
3495
3496
 
3496
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3497
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3497
3498
 
3498
3499
  /*
3499
3500
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3532,7 +3533,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3532
3533
  },
3533
3534
  };
3534
3535
 
3535
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3536
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3536
3537
 
3537
3538
  /*
3538
3539
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3723,12 +3724,12 @@ class Logger {
3723
3724
  }
3724
3725
  }
3725
3726
 
3726
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3727
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3727
3728
  /* eslint-disable header/header */
3728
3729
  const name$1 = "@azure/msal-common";
3729
- const version$1 = "14.12.0";
3730
+ const version$1 = "14.13.0";
3730
3731
 
3731
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3732
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3732
3733
 
3733
3734
  /*
3734
3735
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3928,7 +3929,7 @@ class ScopeSet {
3928
3929
  }
3929
3930
  }
3930
3931
 
3931
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3932
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3932
3933
 
3933
3934
  /*
3934
3935
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3968,7 +3969,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
3968
3969
  };
3969
3970
  }
3970
3971
 
3971
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3972
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
3972
3973
  /*
3973
3974
  * Copyright (c) Microsoft Corporation. All rights reserved.
3974
3975
  * Licensed under the MIT License.
@@ -4030,7 +4031,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
4030
4031
  return updatedAccountInfo;
4031
4032
  }
4032
4033
 
4033
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4034
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4034
4035
  /*
4035
4036
  * Copyright (c) Microsoft Corporation. All rights reserved.
4036
4037
  * Licensed under the MIT License.
@@ -4052,7 +4053,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
4052
4053
  return null;
4053
4054
  }
4054
4055
 
4055
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4056
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4056
4057
 
4057
4058
  /*
4058
4059
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4175,21 +4176,21 @@ class AccountEntity {
4175
4176
  // How do you account for MSA CID here?
4176
4177
  account.localAccountId =
4177
4178
  clientInfo?.uid ||
4178
- accountDetails.idTokenClaims.oid ||
4179
- accountDetails.idTokenClaims.sub ||
4179
+ accountDetails.idTokenClaims?.oid ||
4180
+ accountDetails.idTokenClaims?.sub ||
4180
4181
  "";
4181
4182
  /*
4182
4183
  * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
4183
4184
  * In most cases it will contain a single email. This field should not be relied upon if a custom
4184
4185
  * policy is configured to return more than 1 email.
4185
4186
  */
4186
- const preferredUsername = accountDetails.idTokenClaims.preferred_username ||
4187
- accountDetails.idTokenClaims.upn;
4188
- const email = accountDetails.idTokenClaims.emails
4187
+ const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
4188
+ accountDetails.idTokenClaims?.upn;
4189
+ const email = accountDetails.idTokenClaims?.emails
4189
4190
  ? accountDetails.idTokenClaims.emails[0]
4190
4191
  : null;
4191
4192
  account.username = preferredUsername || email || "";
4192
- account.name = accountDetails.idTokenClaims.name;
4193
+ account.name = accountDetails.idTokenClaims?.name || "";
4193
4194
  account.cloudGraphHostName = accountDetails.cloudGraphHostName;
4194
4195
  account.msGraphHost = accountDetails.msGraphHost;
4195
4196
  if (accountDetails.tenantProfiles) {
@@ -4299,7 +4300,7 @@ class AccountEntity {
4299
4300
  }
4300
4301
  }
4301
4302
 
4302
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4303
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4303
4304
  /*
4304
4305
  * Copyright (c) Microsoft Corporation. All rights reserved.
4305
4306
  * Licensed under the MIT License.
@@ -4307,7 +4308,7 @@ class AccountEntity {
4307
4308
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
4308
4309
  const cacheUnknownErrorCode = "cache_error_unknown";
4309
4310
 
4310
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4311
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4311
4312
 
4312
4313
  /*
4313
4314
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4334,7 +4335,7 @@ class CacheError extends Error {
4334
4335
  }
4335
4336
  }
4336
4337
 
4337
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4338
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
4338
4339
 
4339
4340
  /*
4340
4341
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5589,7 +5590,7 @@ class DefaultStorageClass extends CacheManager {
5589
5590
  }
5590
5591
  }
5591
5592
 
5592
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5593
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5593
5594
 
5594
5595
  /*
5595
5596
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5687,7 +5688,7 @@ function isOidcProtocolMode(config) {
5687
5688
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5688
5689
  }
5689
5690
 
5690
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5691
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5691
5692
 
5692
5693
  /*
5693
5694
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5697,15 +5698,16 @@ function isOidcProtocolMode(config) {
5697
5698
  * Error thrown when there is an error with the server code, for example, unavailability.
5698
5699
  */
5699
5700
  class ServerError extends AuthError {
5700
- constructor(errorCode, errorMessage, subError, errorNo) {
5701
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
5701
5702
  super(errorCode, errorMessage, subError);
5702
5703
  this.name = "ServerError";
5703
5704
  this.errorNo = errorNo;
5705
+ this.status = status;
5704
5706
  Object.setPrototypeOf(this, ServerError.prototype);
5705
5707
  }
5706
5708
  }
5707
5709
 
5708
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5710
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5709
5711
 
5710
5712
  /*
5711
5713
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5803,7 +5805,7 @@ class ThrottlingUtils {
5803
5805
  }
5804
5806
  }
5805
5807
 
5806
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5808
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5807
5809
 
5808
5810
  /*
5809
5811
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5840,7 +5842,7 @@ class NetworkManager {
5840
5842
  }
5841
5843
  }
5842
5844
 
5843
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5845
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5844
5846
  /*
5845
5847
  * Copyright (c) Microsoft Corporation. All rights reserved.
5846
5848
  * Licensed under the MIT License.
@@ -5850,7 +5852,7 @@ const CcsCredentialType = {
5850
5852
  UPN: "UPN",
5851
5853
  };
5852
5854
 
5853
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5855
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5854
5856
 
5855
5857
  /*
5856
5858
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5915,26 +5917,9 @@ class RequestValidator {
5915
5917
  throw createClientConfigurationError(invalidCodeChallengeMethod);
5916
5918
  }
5917
5919
  }
5918
- /**
5919
- * Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
5920
- * @param request
5921
- */
5922
- static sanitizeEQParams(eQParams, queryParams) {
5923
- if (!eQParams) {
5924
- return {};
5925
- }
5926
- // Remove any query parameters already included in SSO params
5927
- queryParams.forEach((_value, key) => {
5928
- if (eQParams[key]) {
5929
- delete eQParams[key];
5930
- }
5931
- });
5932
- // remove empty string parameters
5933
- return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
5934
- }
5935
5920
  }
5936
5921
 
5937
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5922
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
5938
5923
 
5939
5924
  /*
5940
5925
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6222,9 +6207,10 @@ class RequestParameterBuilder {
6222
6207
  * @param eQParams
6223
6208
  */
6224
6209
  addExtraQueryParameters(eQParams) {
6225
- const sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
6226
- Object.keys(sanitizedEQParams).forEach((key) => {
6227
- this.parameters.set(key, eQParams[key]);
6210
+ Object.entries(eQParams).forEach(([key, value]) => {
6211
+ if (!this.parameters.has(key) && value) {
6212
+ this.parameters.set(key, value);
6213
+ }
6228
6214
  });
6229
6215
  }
6230
6216
  addClientCapabilitiesToClaims(claims, clientCapabilities) {
@@ -6318,7 +6304,7 @@ class RequestParameterBuilder {
6318
6304
  }
6319
6305
  }
6320
6306
 
6321
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6307
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6322
6308
 
6323
6309
  /*
6324
6310
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6421,7 +6407,7 @@ class BaseClient {
6421
6407
  }
6422
6408
  }
6423
6409
 
6424
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6410
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6425
6411
  /*
6426
6412
  * Copyright (c) Microsoft Corporation. All rights reserved.
6427
6413
  * Licensed under the MIT License.
@@ -6447,7 +6433,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6447
6433
  refreshTokenExpired: refreshTokenExpired
6448
6434
  });
6449
6435
 
6450
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6436
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6451
6437
 
6452
6438
  /*
6453
6439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6535,23 +6521,7 @@ function createInteractionRequiredAuthError(errorCode) {
6535
6521
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6536
6522
  }
6537
6523
 
6538
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6539
- /*
6540
- * Copyright (c) Microsoft Corporation. All rights reserved.
6541
- * Licensed under the MIT License.
6542
- */
6543
- /** @internal */
6544
- class CacheRecord {
6545
- constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
6546
- this.account = accountEntity || null;
6547
- this.idToken = idTokenEntity || null;
6548
- this.accessToken = accessTokenEntity || null;
6549
- this.refreshToken = refreshTokenEntity || null;
6550
- this.appMetadata = appMetadataEntity || null;
6551
- }
6552
- }
6553
-
6554
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6524
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6555
6525
 
6556
6526
  /*
6557
6527
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6623,7 +6593,7 @@ class ProtocolUtils {
6623
6593
  }
6624
6594
  }
6625
6595
 
6626
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6596
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6627
6597
 
6628
6598
  /*
6629
6599
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6707,7 +6677,7 @@ class PopTokenGenerator {
6707
6677
  }
6708
6678
  }
6709
6679
 
6710
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6680
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6711
6681
  /*
6712
6682
  * Copyright (c) Microsoft Corporation. All rights reserved.
6713
6683
  * Licensed under the MIT License.
@@ -6734,7 +6704,7 @@ class PopTokenGenerator {
6734
6704
  }
6735
6705
  }
6736
6706
 
6737
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6707
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
6738
6708
 
6739
6709
  /*
6740
6710
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6811,11 +6781,11 @@ class ResponseHandler {
6811
6781
  if (serverResponse.error ||
6812
6782
  serverResponse.error_description ||
6813
6783
  serverResponse.suberror) {
6814
- const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
6784
+ const errString = `Error(s): ${serverResponse.error_codes || Constants.NOT_AVAILABLE} - Timestamp: ${serverResponse.timestamp || Constants.NOT_AVAILABLE} - Description: ${serverResponse.error_description || Constants.NOT_AVAILABLE} - Correlation ID: ${serverResponse.correlation_id || Constants.NOT_AVAILABLE} - Trace ID: ${serverResponse.trace_id || Constants.NOT_AVAILABLE}`;
6815
6785
  const serverErrorNo = serverResponse.error_codes?.length
6816
6786
  ? serverResponse.error_codes[0]
6817
6787
  : undefined;
6818
- const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
6788
+ const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
6819
6789
  // check if 500 error
6820
6790
  if (refreshAccessToken &&
6821
6791
  serverResponse.status &&
@@ -6929,7 +6899,7 @@ class ResponseHandler {
6929
6899
  let cachedAccount;
6930
6900
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6931
6901
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6932
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, idTokenClaims, this.cryptoObj.base64Decode, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6902
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6933
6903
  this.logger);
6934
6904
  }
6935
6905
  // AccessToken
@@ -6982,7 +6952,13 @@ class ResponseHandler {
6982
6952
  familyId: serverTokenResponse.foci,
6983
6953
  };
6984
6954
  }
6985
- return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
6955
+ return {
6956
+ account: cachedAccount,
6957
+ idToken: cachedIdToken,
6958
+ accessToken: cachedAccessToken,
6959
+ refreshToken: cachedRefreshToken,
6960
+ appMetadata: cachedAppMetadata,
6961
+ };
6986
6962
  }
6987
6963
  /**
6988
6964
  * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
@@ -7071,7 +7047,7 @@ class ResponseHandler {
7071
7047
  };
7072
7048
  }
7073
7049
  }
7074
- function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7050
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7075
7051
  logger?.verbose("setCachedAccount called");
7076
7052
  // Check if base account is already cached
7077
7053
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7094,6 +7070,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
7094
7070
  }, authority, base64Decode);
7095
7071
  const tenantProfiles = baseAccount.tenantProfiles || [];
7096
7072
  if (claimsTenantId &&
7073
+ idTokenClaims &&
7097
7074
  !tenantProfiles.find((tenantProfile) => {
7098
7075
  return tenantProfile.tenantId === claimsTenantId;
7099
7076
  })) {
@@ -7104,7 +7081,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
7104
7081
  return baseAccount;
7105
7082
  }
7106
7083
 
7107
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7084
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7108
7085
 
7109
7086
  /*
7110
7087
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7527,7 +7504,7 @@ class AuthorizationCodeClient extends BaseClient {
7527
7504
  }
7528
7505
  }
7529
7506
 
7530
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7507
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7531
7508
 
7532
7509
  /*
7533
7510
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7741,7 +7718,7 @@ class RefreshTokenClient extends BaseClient {
7741
7718
  }
7742
7719
  }
7743
7720
 
7744
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7721
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7745
7722
 
7746
7723
  /*
7747
7724
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7877,7 +7854,7 @@ class SilentFlowClient extends BaseClient {
7877
7854
  }
7878
7855
  }
7879
7856
 
7880
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7857
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7881
7858
 
7882
7859
  /*
7883
7860
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7892,7 +7869,7 @@ const StubbedNetworkModule = {
7892
7869
  },
7893
7870
  };
7894
7871
 
7895
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7872
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7896
7873
  /*
7897
7874
  * Copyright (c) Microsoft Corporation. All rights reserved.
7898
7875
  * Licensed under the MIT License.
@@ -7900,7 +7877,7 @@ const StubbedNetworkModule = {
7900
7877
  const missingKidError = "missing_kid_error";
7901
7878
  const missingAlgError = "missing_alg_error";
7902
7879
 
7903
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7880
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7904
7881
 
7905
7882
  /*
7906
7883
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7925,7 +7902,7 @@ function createJoseHeaderError(code) {
7925
7902
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7926
7903
  }
7927
7904
 
7928
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7905
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7929
7906
 
7930
7907
  /*
7931
7908
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7965,7 +7942,7 @@ class JoseHeader {
7965
7942
  }
7966
7943
  }
7967
7944
 
7968
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7945
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
7969
7946
 
7970
7947
  /*
7971
7948
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8023,7 +8000,7 @@ class AuthenticationHeaderParser {
8023
8000
  }
8024
8001
  }
8025
8002
 
8026
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8003
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8027
8004
 
8028
8005
  /*
8029
8006
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8227,7 +8204,7 @@ class ServerTelemetryManager {
8227
8204
  }
8228
8205
  }
8229
8206
 
8230
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8207
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8231
8208
 
8232
8209
  /*
8233
8210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8306,7 +8283,7 @@ class StubPerformanceClient {
8306
8283
  }
8307
8284
  }
8308
8285
 
8309
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8286
+ /*! @azure/msal-common v14.13.0 2024-07-01 */
8310
8287
 
8311
8288
  /*
8312
8289
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10177,7 +10154,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
10177
10154
 
10178
10155
  /* eslint-disable header/header */
10179
10156
  const name = "@azure/msal-browser";
10180
- const version = "3.17.0";
10157
+ const version = "3.18.0";
10181
10158
 
10182
10159
  /*
10183
10160
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12437,7 +12414,10 @@ class BrowserCacheManager extends CacheManager {
12437
12414
  const accessTokenEntity = createAccessTokenEntity(result.account?.homeAccountId, result.account.environment, result.accessToken, this.clientId, result.tenantId, result.scopes.join(" "), result.expiresOn ? result.expiresOn.getTime() / 1000 : 0, result.extExpiresOn ? result.extExpiresOn.getTime() / 1000 : 0, base64Decode, undefined, // refreshOn
12438
12415
  result.tokenType, undefined, // userAssertionHash
12439
12416
  request.sshKid, request.claims, claimsHash);
12440
- const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
12417
+ const cacheRecord = {
12418
+ idToken: idTokenEntity,
12419
+ accessToken: accessTokenEntity,
12420
+ };
12441
12421
  return this.saveCacheRecord(cacheRecord);
12442
12422
  }
12443
12423
  /**
@@ -13533,7 +13513,7 @@ class NativeInteractionClient extends BaseInteractionClient {
13533
13513
  }
13534
13514
  // Get the preferred_cache domain for the given authority
13535
13515
  const authority = await this.getDiscoveredAuthority(request.authority);
13536
- const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, idTokenClaims, base64Decode, response.client_info, undefined, // environment
13516
+ const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
13537
13517
  idTokenClaims.tid, undefined, // auth code payload
13538
13518
  response.account.id, this.logger);
13539
13519
  // generate authenticationResult
@@ -13693,7 +13673,10 @@ class NativeInteractionClient extends BaseInteractionClient {
13693
13673
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13694
13674
  const responseScopes = this.generateScopes(response, request);
13695
13675
  const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
13696
- const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
13676
+ const nativeCacheRecord = {
13677
+ idToken: cachedIdToken,
13678
+ accessToken: cachedAccessToken,
13679
+ };
13697
13680
  void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13698
13681
  }
13699
13682
  addTelemetryFromNativeResponse(response) {
@@ -15461,47 +15444,32 @@ class TokenCache {
15461
15444
  * @returns `AuthenticationResult` for the response that was loaded.
15462
15445
  */
15463
15446
  loadExternalTokens(request, response, options) {
15464
- this.logger.info("TokenCache - loadExternalTokens called");
15465
- if (!response.id_token) {
15466
- throw createBrowserAuthError(unableToLoadToken);
15447
+ if (!this.isBrowserEnvironment) {
15448
+ throw createBrowserAuthError(nonBrowserEnvironment);
15467
15449
  }
15468
- const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
15469
- let cacheRecord;
15470
- let authority;
15471
- let cacheRecordAccount;
15472
- if (request.account) {
15473
- cacheRecordAccount = AccountEntity.createFromAccountInfo(request.account);
15474
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment));
15475
- }
15476
- else if (request.authority) {
15477
- const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
15478
- const authorityOptions = {
15479
- protocolMode: this.config.auth.protocolMode,
15480
- knownAuthorities: this.config.auth.knownAuthorities,
15481
- cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15482
- authorityMetadata: this.config.auth.authorityMetadata,
15483
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15484
- };
15485
- authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid());
15486
- // "clientInfo" from options takes precedence over "clientInfo" in response
15487
- if (options.clientInfo) {
15488
- this.logger.trace("TokenCache - homeAccountId from options");
15489
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, options.clientInfo);
15490
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
15491
- }
15492
- else if (response.client_info) {
15493
- this.logger.trace("TokenCache - homeAccountId from response");
15494
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, response.client_info);
15495
- cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(response.id_token, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
15496
- }
15497
- else {
15498
- throw createBrowserAuthError(unableToLoadToken);
15499
- }
15500
- }
15501
- else {
15502
- throw createBrowserAuthError(unableToLoadToken);
15503
- }
15504
- return this.generateAuthenticationResult(request, idTokenClaims, cacheRecord, cacheRecordAccount, authority);
15450
+ const idTokenClaims = response.id_token
15451
+ ? extractTokenClaims(response.id_token, base64Decode)
15452
+ : undefined;
15453
+ const authorityOptions = {
15454
+ protocolMode: this.config.auth.protocolMode,
15455
+ knownAuthorities: this.config.auth.knownAuthorities,
15456
+ cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15457
+ authorityMetadata: this.config.auth.authorityMetadata,
15458
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15459
+ };
15460
+ const authority = request.authority
15461
+ ? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
15462
+ : undefined;
15463
+ const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
15464
+ const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
15465
+ const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
15466
+ const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
15467
+ return this.generateAuthenticationResult(request, {
15468
+ account: cacheRecordAccount,
15469
+ idToken,
15470
+ accessToken,
15471
+ refreshToken,
15472
+ }, idTokenClaims, authority);
15505
15473
  }
15506
15474
  /**
15507
15475
  * Helper function to load account to msal-browser cache
@@ -15512,29 +15480,24 @@ class TokenCache {
15512
15480
  * @param requestHomeAccountId
15513
15481
  * @returns `AccountEntity`
15514
15482
  */
15515
- loadAccount(idTokenClaims, authority, clientInfo, requestHomeAccountId) {
15516
- if (this.isBrowserEnvironment) {
15517
- this.logger.verbose("TokenCache - loading account");
15518
- let homeAccountId;
15519
- if (requestHomeAccountId) {
15520
- homeAccountId = requestHomeAccountId;
15521
- }
15522
- else if (authority.authorityType !== undefined && clientInfo) {
15523
- homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15524
- }
15525
- if (!homeAccountId) {
15526
- throw createBrowserAuthError(unableToLoadToken);
15527
- }
15528
- const claimsTenantId = idTokenClaims.tid;
15529
- const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15530
- undefined, // nativeAccountId
15531
- this.logger);
15532
- this.storage.setAccount(cachedAccount);
15533
- return cachedAccount;
15483
+ loadAccount(request, clientInfo, idTokenClaims, authority) {
15484
+ this.logger.verbose("TokenCache - loading account");
15485
+ if (request.account) {
15486
+ const accountEntity = AccountEntity.createFromAccountInfo(request.account);
15487
+ this.storage.setAccount(accountEntity);
15488
+ return accountEntity;
15534
15489
  }
15535
- else {
15490
+ else if (!authority || (!clientInfo && !idTokenClaims)) {
15491
+ this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead.");
15536
15492
  throw createBrowserAuthError(unableToLoadToken);
15537
15493
  }
15494
+ const homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15495
+ const claimsTenantId = idTokenClaims?.tid;
15496
+ const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15497
+ undefined, // nativeAccountId
15498
+ this.logger);
15499
+ this.storage.setAccount(cachedAccount);
15500
+ return cachedAccount;
15538
15501
  }
15539
15502
  /**
15540
15503
  * Helper function to load id tokens to msal-browser cache
@@ -15544,16 +15507,15 @@ class TokenCache {
15544
15507
  * @param tenantId
15545
15508
  * @returns `IdTokenEntity`
15546
15509
  */
15547
- loadIdToken(idToken, homeAccountId, environment, tenantId) {
15548
- const idTokenEntity = createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
15549
- if (this.isBrowserEnvironment) {
15550
- this.logger.verbose("TokenCache - loading id token");
15551
- this.storage.setIdTokenCredential(idTokenEntity);
15552
- return idTokenEntity;
15553
- }
15554
- else {
15555
- throw createBrowserAuthError(unableToLoadToken);
15510
+ loadIdToken(response, homeAccountId, environment, tenantId) {
15511
+ if (!response.id_token) {
15512
+ this.logger.verbose("TokenCache - no id token found in response");
15513
+ return null;
15556
15514
  }
15515
+ this.logger.verbose("TokenCache - loading id token");
15516
+ const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
15517
+ this.storage.setIdTokenCredential(idTokenEntity);
15518
+ return idTokenEntity;
15557
15519
  }
15558
15520
  /**
15559
15521
  * Helper function to load access tokens to msal-browser cache
@@ -15566,28 +15528,30 @@ class TokenCache {
15566
15528
  */
15567
15529
  loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
15568
15530
  if (!response.access_token) {
15569
- this.logger.verbose("TokenCache - No access token provided for caching");
15531
+ this.logger.verbose("TokenCache - no access token found in response");
15570
15532
  return null;
15571
15533
  }
15572
- if (!response.expires_in) {
15573
- throw createBrowserAuthError(unableToLoadToken);
15534
+ else if (!response.expires_in) {
15535
+ this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache.");
15536
+ return null;
15574
15537
  }
15575
- if (!options.extendedExpiresOn) {
15576
- throw createBrowserAuthError(unableToLoadToken);
15538
+ else if (!response.scope &&
15539
+ (!request.scopes || !request.scopes.length)) {
15540
+ this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache.");
15541
+ return null;
15577
15542
  }
15578
- const scopes = new ScopeSet(request.scopes).printScopes();
15543
+ this.logger.verbose("TokenCache - loading access token");
15544
+ const scopes = response.scope
15545
+ ? ScopeSet.fromString(response.scope)
15546
+ : new ScopeSet(request.scopes);
15579
15547
  const expiresOn = options.expiresOn ||
15580
15548
  response.expires_in + new Date().getTime() / 1000;
15581
- const extendedExpiresOn = options.extendedExpiresOn;
15582
- const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, base64Decode);
15583
- if (this.isBrowserEnvironment) {
15584
- this.logger.verbose("TokenCache - loading access token");
15585
- this.storage.setAccessTokenCredential(accessTokenEntity);
15586
- return accessTokenEntity;
15587
- }
15588
- else {
15589
- throw createBrowserAuthError(unableToLoadToken);
15590
- }
15549
+ const extendedExpiresOn = options.extendedExpiresOn ||
15550
+ (response.ext_expires_in || response.expires_in) +
15551
+ new Date().getTime() / 1000;
15552
+ const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
15553
+ this.storage.setAccessTokenCredential(accessTokenEntity);
15554
+ return accessTokenEntity;
15591
15555
  }
15592
15556
  /**
15593
15557
  * Helper function to load refresh tokens to msal-browser cache
@@ -15597,20 +15561,16 @@ class TokenCache {
15597
15561
  * @param environment
15598
15562
  * @returns `RefreshTokenEntity`
15599
15563
  */
15600
- loadRefreshToken(request, response, homeAccountId, environment) {
15564
+ loadRefreshToken(response, homeAccountId, environment) {
15601
15565
  if (!response.refresh_token) {
15602
- this.logger.verbose("TokenCache - No refresh token provided for caching");
15566
+ this.logger.verbose("TokenCache - no refresh token found in response");
15603
15567
  return null;
15604
15568
  }
15605
- const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);
15606
- if (this.isBrowserEnvironment) {
15607
- this.logger.verbose("TokenCache - loading refresh token");
15608
- this.storage.setRefreshTokenCredential(refreshTokenEntity);
15609
- return refreshTokenEntity;
15610
- }
15611
- else {
15612
- throw createBrowserAuthError(unableToLoadToken);
15613
- }
15569
+ this.logger.verbose("TokenCache - loading refresh token");
15570
+ const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
15571
+ response.refresh_token_expires_in);
15572
+ this.storage.setRefreshTokenCredential(refreshTokenEntity);
15573
+ return refreshTokenEntity;
15614
15574
  }
15615
15575
  /**
15616
15576
  * Helper function to generate an `AuthenticationResult` for the result.
@@ -15620,8 +15580,8 @@ class TokenCache {
15620
15580
  * @param authority
15621
15581
  * @returns `AuthenticationResult`
15622
15582
  */
15623
- generateAuthenticationResult(request, idTokenClaims, cacheRecord, accountEntity, authority) {
15624
- let accessToken = Constants.EMPTY_STRING;
15583
+ generateAuthenticationResult(request, cacheRecord, idTokenClaims, authority) {
15584
+ let accessToken = "";
15625
15585
  let responseScopes = [];
15626
15586
  let expiresOn = null;
15627
15587
  let extExpiresOn;
@@ -15631,14 +15591,11 @@ class TokenCache {
15631
15591
  expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
15632
15592
  extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
15633
15593
  }
15634
- const uid = idTokenClaims.oid || idTokenClaims.sub || Constants.EMPTY_STRING;
15635
- const tid = idTokenClaims.tid || Constants.EMPTY_STRING;
15594
+ const accountEntity = cacheRecord.account;
15636
15595
  return {
15637
- authority: authority
15638
- ? authority.canonicalAuthority
15639
- : Constants.EMPTY_STRING,
15640
- uniqueId: uid,
15641
- tenantId: tid,
15596
+ authority: authority ? authority.canonicalAuthority : "",
15597
+ uniqueId: cacheRecord.account.localAccountId,
15598
+ tenantId: cacheRecord.account.realm,
15642
15599
  scopes: responseScopes,
15643
15600
  account: accountEntity.getAccountInfo(),
15644
15601
  idToken: cacheRecord.idToken?.secret || "",
@@ -15646,15 +15603,14 @@ class TokenCache {
15646
15603
  accessToken: accessToken,
15647
15604
  fromCache: true,
15648
15605
  expiresOn: expiresOn,
15649
- correlationId: request.correlationId || Constants.EMPTY_STRING,
15650
- requestId: Constants.EMPTY_STRING,
15606
+ correlationId: request.correlationId || "",
15607
+ requestId: "",
15651
15608
  extExpiresOn: extExpiresOn,
15652
- familyId: Constants.EMPTY_STRING,
15653
- tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,
15654
- state: Constants.EMPTY_STRING,
15655
- cloudGraphHostName: accountEntity.cloudGraphHostName || Constants.EMPTY_STRING,
15656
- msGraphHost: accountEntity.msGraphHost || Constants.EMPTY_STRING,
15657
- code: undefined,
15609
+ familyId: cacheRecord.refreshToken?.familyId || "",
15610
+ tokenType: cacheRecord?.accessToken?.tokenType || "",
15611
+ state: request.state || "",
15612
+ cloudGraphHostName: accountEntity.cloudGraphHostName || "",
15613
+ msGraphHost: accountEntity.msGraphHost || "",
15658
15614
  fromNativeBroker: false,
15659
15615
  };
15660
15616
  }
@@ -16896,12 +16852,13 @@ class StandardController {
16896
16852
  * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
16897
16853
  */
16898
16854
  async acquireTokenSilentAsync(request, account) {
16855
+ const trackPageVisibility = () => this.trackPageVisibility(request.correlationId);
16899
16856
  this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
16900
16857
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
16901
16858
  if (request.correlationId) {
16902
16859
  this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
16903
16860
  }
16904
- document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16861
+ document.addEventListener("visibilitychange", trackPageVisibility);
16905
16862
  const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
16906
16863
  const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
16907
16864
  const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
@@ -16980,7 +16937,7 @@ class StandardController {
16980
16937
  throw tokenRenewalError;
16981
16938
  })
16982
16939
  .finally(() => {
16983
- document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16940
+ document.removeEventListener("visibilitychange", trackPageVisibility);
16984
16941
  });
16985
16942
  }
16986
16943
  /**
@@ -17241,7 +17198,7 @@ class NestedAppAuthAdapter {
17241
17198
  const NestedAppAuthErrorMessage = {
17242
17199
  unsupportedMethod: {
17243
17200
  code: "unsupported_method",
17244
- desc: "The PKCE code challenge and verifier could not be generated.",
17201
+ desc: "This method is not supported in nested app environment.",
17245
17202
  },
17246
17203
  };
17247
17204
  class NestedAppAuthError extends AuthError {