@azure/msal-browser 3.17.0 → 3.19.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 (110) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +2 -1
  2. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/IPublicClientApplication.mjs +1 -1
  4. package/dist/app/IPublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientApplication.d.ts +8 -1
  6. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  7. package/dist/app/PublicClientApplication.mjs +9 -4
  8. package/dist/app/PublicClientApplication.mjs.map +1 -1
  9. package/dist/app/PublicClientNext.mjs +1 -1
  10. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  11. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  12. package/dist/cache/AccountManager.mjs +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  14. package/dist/cache/BrowserCacheManager.d.ts +2 -1
  15. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  16. package/dist/cache/BrowserCacheManager.mjs +9 -5
  17. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  18. package/dist/cache/BrowserStorage.mjs +1 -1
  19. package/dist/cache/DatabaseStorage.mjs +1 -1
  20. package/dist/cache/MemoryStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.d.ts.map +1 -1
  22. package/dist/cache/TokenCache.mjs +90 -117
  23. package/dist/cache/TokenCache.mjs.map +1 -1
  24. package/dist/config/Configuration.mjs +1 -1
  25. package/dist/controllers/ControllerFactory.d.ts +2 -1
  26. package/dist/controllers/ControllerFactory.d.ts.map +1 -1
  27. package/dist/controllers/ControllerFactory.mjs +3 -3
  28. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  29. package/dist/controllers/IController.d.ts +2 -1
  30. package/dist/controllers/IController.d.ts.map +1 -1
  31. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  32. package/dist/controllers/StandardController.d.ts +4 -2
  33. package/dist/controllers/StandardController.d.ts.map +1 -1
  34. package/dist/controllers/StandardController.mjs +11 -8
  35. package/dist/controllers/StandardController.mjs.map +1 -1
  36. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  37. package/dist/crypto/BrowserCrypto.mjs +1 -1
  38. package/dist/crypto/CryptoOps.mjs +1 -1
  39. package/dist/crypto/PkceGenerator.mjs +1 -1
  40. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  41. package/dist/encode/Base64Decode.mjs +1 -1
  42. package/dist/encode/Base64Encode.mjs +1 -1
  43. package/dist/error/BrowserAuthError.mjs +1 -1
  44. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  45. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  46. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  47. package/dist/error/NativeAuthError.mjs +1 -1
  48. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  49. package/dist/error/NestedAppAuthError.mjs +2 -2
  50. package/dist/error/NestedAppAuthError.mjs.map +1 -1
  51. package/dist/event/EventHandler.mjs +1 -1
  52. package/dist/event/EventMessage.mjs +1 -1
  53. package/dist/event/EventType.mjs +1 -1
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.mjs +1 -1
  57. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  58. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  59. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  60. package/dist/interaction_client/NativeInteractionClient.mjs +11 -7
  61. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  62. package/dist/interaction_client/PopupClient.mjs +1 -1
  63. package/dist/interaction_client/RedirectClient.mjs +1 -1
  64. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  65. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  66. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  67. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  68. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  69. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  70. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  71. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  72. package/dist/naa/BridgeError.mjs +1 -1
  73. package/dist/naa/BridgeProxy.mjs +1 -1
  74. package/dist/naa/BridgeStatusCode.mjs +1 -1
  75. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  76. package/dist/navigation/NavigationClient.mjs +1 -1
  77. package/dist/network/FetchClient.mjs +1 -1
  78. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  79. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  80. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  81. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  82. package/dist/packageMetadata.d.ts +1 -1
  83. package/dist/packageMetadata.mjs +2 -2
  84. package/dist/request/InitializeApplicationRequest.d.ts +9 -0
  85. package/dist/request/InitializeApplicationRequest.d.ts.map +1 -0
  86. package/dist/request/RequestHelpers.mjs +1 -1
  87. package/dist/response/ResponseHandler.mjs +1 -1
  88. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  89. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  90. package/dist/utils/BrowserConstants.mjs +1 -1
  91. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  92. package/dist/utils/BrowserUtils.mjs +1 -1
  93. package/lib/msal-browser.cjs +214 -248
  94. package/lib/msal-browser.cjs.map +1 -1
  95. package/lib/msal-browser.js +214 -248
  96. package/lib/msal-browser.js.map +1 -1
  97. package/lib/msal-browser.min.js +63 -64
  98. package/package.json +3 -2
  99. package/src/app/IPublicClientApplication.ts +3 -1
  100. package/src/app/PublicClientApplication.ts +9 -3
  101. package/src/cache/BrowserCacheManager.ts +9 -7
  102. package/src/cache/TokenCache.ts +158 -243
  103. package/src/controllers/ControllerFactory.ts +4 -2
  104. package/src/controllers/IController.ts +3 -1
  105. package/src/controllers/StandardController.ts +19 -11
  106. package/src/error/NestedAppAuthError.ts +1 -1
  107. package/src/index.ts +1 -0
  108. package/src/interaction_client/NativeInteractionClient.ts +12 -10
  109. package/src/packageMetadata.ts +1 -1
  110. package/src/request/InitializeApplicationRequest.ts +13 -0
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.17.0 2024-06-10 */
1
+ /*! @azure/msal-browser v3.19.0 2024-07-12 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v14.12.0 2024-06-10 */
9
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -52,6 +52,7 @@
52
52
  NOT_DEFINED: "not_defined",
53
53
  EMPTY_STRING: "",
54
54
  NOT_APPLICABLE: "N/A",
55
+ NOT_AVAILABLE: "Not Available",
55
56
  FORWARD_SLASH: "/",
56
57
  IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
57
58
  IMDS_VERSION: "2020-06-01",
@@ -314,7 +315,7 @@
314
315
  // Token renewal offset default in seconds
315
316
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
316
317
 
317
- /*! @azure/msal-common v14.12.0 2024-06-10 */
318
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
318
319
  /*
319
320
  * Copyright (c) Microsoft Corporation. All rights reserved.
320
321
  * Licensed under the MIT License.
@@ -331,7 +332,7 @@
331
332
  unexpectedError: unexpectedError
332
333
  });
333
334
 
334
- /*! @azure/msal-common v14.12.0 2024-06-10 */
335
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
335
336
 
336
337
  /*
337
338
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -380,7 +381,7 @@
380
381
  : AuthErrorMessages[code]);
381
382
  }
382
383
 
383
- /*! @azure/msal-common v14.12.0 2024-06-10 */
384
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
384
385
  /*
385
386
  * Copyright (c) Microsoft Corporation. All rights reserved.
386
387
  * Licensed under the MIT License.
@@ -478,7 +479,7 @@
478
479
  userTimeoutReached: userTimeoutReached
479
480
  });
480
481
 
481
- /*! @azure/msal-common v14.12.0 2024-06-10 */
482
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
482
483
 
483
484
  /*
484
485
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -730,7 +731,7 @@
730
731
  return new ClientAuthError(errorCode, additionalMessage);
731
732
  }
732
733
 
733
- /*! @azure/msal-common v14.12.0 2024-06-10 */
734
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
734
735
 
735
736
  /*
736
737
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -791,7 +792,7 @@
791
792
  }
792
793
  }
793
794
 
794
- /*! @azure/msal-common v14.12.0 2024-06-10 */
795
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
795
796
  /*
796
797
  * Copyright (c) Microsoft Corporation. All rights reserved.
797
798
  * Licensed under the MIT License.
@@ -806,7 +807,7 @@
806
807
  Ciam: 3,
807
808
  };
808
809
 
809
- /*! @azure/msal-common v14.12.0 2024-06-10 */
810
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
810
811
  /*
811
812
  * Copyright (c) Microsoft Corporation. All rights reserved.
812
813
  * Licensed under the MIT License.
@@ -818,7 +819,7 @@
818
819
  response.hasOwnProperty("jwks_uri"));
819
820
  }
820
821
 
821
- /*! @azure/msal-common v14.12.0 2024-06-10 */
822
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
822
823
  /*
823
824
  * Copyright (c) Microsoft Corporation. All rights reserved.
824
825
  * Licensed under the MIT License.
@@ -872,7 +873,7 @@
872
873
  urlParseError: urlParseError
873
874
  });
874
875
 
875
- /*! @azure/msal-common v14.12.0 2024-06-10 */
876
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
876
877
 
877
878
  /*
878
879
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1010,7 +1011,7 @@
1010
1011
  return new ClientConfigurationError(errorCode);
1011
1012
  }
1012
1013
 
1013
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1014
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1014
1015
  /*
1015
1016
  * Copyright (c) Microsoft Corporation. All rights reserved.
1016
1017
  * Licensed under the MIT License.
@@ -1107,7 +1108,7 @@
1107
1108
  }
1108
1109
  }
1109
1110
 
1110
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1111
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1111
1112
 
1112
1113
  /*
1113
1114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1154,7 +1155,7 @@
1154
1155
  return null;
1155
1156
  }
1156
1157
 
1157
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1158
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1158
1159
 
1159
1160
  /*
1160
1161
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1318,7 +1319,7 @@
1318
1319
  }
1319
1320
  }
1320
1321
 
1321
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1322
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1322
1323
 
1323
1324
  /*
1324
1325
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1458,7 +1459,7 @@
1458
1459
  return null;
1459
1460
  }
1460
1461
 
1461
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1462
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1462
1463
  /*
1463
1464
  * Copyright (c) Microsoft Corporation. All rights reserved.
1464
1465
  * Licensed under the MIT License.
@@ -1471,7 +1472,7 @@
1471
1472
  OIDC: "OIDC",
1472
1473
  };
1473
1474
 
1474
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1475
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1475
1476
  /*
1476
1477
  * Copyright (c) Microsoft Corporation. All rights reserved.
1477
1478
  * Licensed under the MIT License.
@@ -1491,7 +1492,7 @@
1491
1492
  AzureUsGovernment: "https://login.microsoftonline.us",
1492
1493
  };
1493
1494
 
1494
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1495
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1495
1496
  /*
1496
1497
  * Copyright (c) Microsoft Corporation. All rights reserved.
1497
1498
  * Licensed under the MIT License.
@@ -1501,7 +1502,7 @@
1501
1502
  response.hasOwnProperty("metadata"));
1502
1503
  }
1503
1504
 
1504
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1505
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1505
1506
  /*
1506
1507
  * Copyright (c) Microsoft Corporation. All rights reserved.
1507
1508
  * Licensed under the MIT License.
@@ -1511,7 +1512,7 @@
1511
1512
  response.hasOwnProperty("error_description"));
1512
1513
  }
1513
1514
 
1514
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1515
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1515
1516
  /*
1516
1517
  * Copyright (c) Microsoft Corporation. All rights reserved.
1517
1518
  * Licensed under the MIT License.
@@ -1993,7 +1994,7 @@
1993
1994
  "multiMatchedRT",
1994
1995
  ]);
1995
1996
 
1996
- /*! @azure/msal-common v14.12.0 2024-06-10 */
1997
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
1997
1998
  /*
1998
1999
  * Copyright (c) Microsoft Corporation. All rights reserved.
1999
2000
  * Licensed under the MIT License.
@@ -2089,7 +2090,7 @@
2089
2090
  };
2090
2091
  };
2091
2092
 
2092
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2093
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
2093
2094
 
2094
2095
  /*
2095
2096
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2198,7 +2199,7 @@
2198
2199
  },
2199
2200
  };
2200
2201
 
2201
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2202
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
2202
2203
  /*
2203
2204
  * Copyright (c) Microsoft Corporation. All rights reserved.
2204
2205
  * Licensed under the MIT License.
@@ -2235,7 +2236,7 @@
2235
2236
  return cachedAtSec > nowSeconds();
2236
2237
  }
2237
2238
 
2238
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2239
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
2239
2240
 
2240
2241
  /*
2241
2242
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2562,7 +2563,7 @@
2562
2563
  return metadata.expiresAt <= nowSeconds();
2563
2564
  }
2564
2565
 
2565
- /*! @azure/msal-common v14.12.0 2024-06-10 */
2566
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
2566
2567
 
2567
2568
  /*
2568
2569
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3401,7 +3402,7 @@
3401
3402
  };
3402
3403
  }
3403
3404
 
3404
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3405
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3405
3406
 
3406
3407
  /*
3407
3408
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3432,7 +3433,7 @@
3432
3433
  }
3433
3434
  }
3434
3435
 
3435
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3436
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3436
3437
  /*
3437
3438
  * Copyright (c) Microsoft Corporation. All rights reserved.
3438
3439
  * Licensed under the MIT License.
@@ -3450,7 +3451,7 @@
3450
3451
  }
3451
3452
  }
3452
3453
 
3453
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3454
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3454
3455
  /*
3455
3456
  * Copyright (c) Microsoft Corporation. All rights reserved.
3456
3457
  * Licensed under the MIT License.
@@ -3497,7 +3498,7 @@
3497
3498
  const LOGIN_HINT = "login_hint";
3498
3499
  const DOMAIN_HINT = "domain_hint";
3499
3500
 
3500
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3501
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3501
3502
 
3502
3503
  /*
3503
3504
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3536,7 +3537,7 @@
3536
3537
  },
3537
3538
  };
3538
3539
 
3539
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3540
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3540
3541
 
3541
3542
  /*
3542
3543
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3727,12 +3728,12 @@
3727
3728
  }
3728
3729
  }
3729
3730
 
3730
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3731
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3731
3732
  /* eslint-disable header/header */
3732
3733
  const name$1 = "@azure/msal-common";
3733
- const version$1 = "14.12.0";
3734
+ const version$1 = "14.13.0";
3734
3735
 
3735
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3736
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3736
3737
 
3737
3738
  /*
3738
3739
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3932,7 +3933,7 @@
3932
3933
  }
3933
3934
  }
3934
3935
 
3935
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3936
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3936
3937
 
3937
3938
  /*
3938
3939
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3972,7 +3973,7 @@
3972
3973
  };
3973
3974
  }
3974
3975
 
3975
- /*! @azure/msal-common v14.12.0 2024-06-10 */
3976
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
3976
3977
  /*
3977
3978
  * Copyright (c) Microsoft Corporation. All rights reserved.
3978
3979
  * Licensed under the MIT License.
@@ -4034,7 +4035,7 @@
4034
4035
  return updatedAccountInfo;
4035
4036
  }
4036
4037
 
4037
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4038
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
4038
4039
  /*
4039
4040
  * Copyright (c) Microsoft Corporation. All rights reserved.
4040
4041
  * Licensed under the MIT License.
@@ -4056,7 +4057,7 @@
4056
4057
  return null;
4057
4058
  }
4058
4059
 
4059
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4060
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
4060
4061
 
4061
4062
  /*
4062
4063
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4179,21 +4180,21 @@
4179
4180
  // How do you account for MSA CID here?
4180
4181
  account.localAccountId =
4181
4182
  clientInfo?.uid ||
4182
- accountDetails.idTokenClaims.oid ||
4183
- accountDetails.idTokenClaims.sub ||
4183
+ accountDetails.idTokenClaims?.oid ||
4184
+ accountDetails.idTokenClaims?.sub ||
4184
4185
  "";
4185
4186
  /*
4186
4187
  * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
4187
4188
  * In most cases it will contain a single email. This field should not be relied upon if a custom
4188
4189
  * policy is configured to return more than 1 email.
4189
4190
  */
4190
- const preferredUsername = accountDetails.idTokenClaims.preferred_username ||
4191
- accountDetails.idTokenClaims.upn;
4192
- const email = accountDetails.idTokenClaims.emails
4191
+ const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
4192
+ accountDetails.idTokenClaims?.upn;
4193
+ const email = accountDetails.idTokenClaims?.emails
4193
4194
  ? accountDetails.idTokenClaims.emails[0]
4194
4195
  : null;
4195
4196
  account.username = preferredUsername || email || "";
4196
- account.name = accountDetails.idTokenClaims.name;
4197
+ account.name = accountDetails.idTokenClaims?.name || "";
4197
4198
  account.cloudGraphHostName = accountDetails.cloudGraphHostName;
4198
4199
  account.msGraphHost = accountDetails.msGraphHost;
4199
4200
  if (accountDetails.tenantProfiles) {
@@ -4303,7 +4304,7 @@
4303
4304
  }
4304
4305
  }
4305
4306
 
4306
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4307
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
4307
4308
  /*
4308
4309
  * Copyright (c) Microsoft Corporation. All rights reserved.
4309
4310
  * Licensed under the MIT License.
@@ -4311,7 +4312,7 @@
4311
4312
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
4312
4313
  const cacheUnknownErrorCode = "cache_error_unknown";
4313
4314
 
4314
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4315
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
4315
4316
 
4316
4317
  /*
4317
4318
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4338,7 +4339,7 @@
4338
4339
  }
4339
4340
  }
4340
4341
 
4341
- /*! @azure/msal-common v14.12.0 2024-06-10 */
4342
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
4342
4343
 
4343
4344
  /*
4344
4345
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5593,7 +5594,7 @@
5593
5594
  }
5594
5595
  }
5595
5596
 
5596
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5597
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5597
5598
 
5598
5599
  /*
5599
5600
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5691,7 +5692,7 @@
5691
5692
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5692
5693
  }
5693
5694
 
5694
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5695
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5695
5696
 
5696
5697
  /*
5697
5698
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5701,15 +5702,16 @@
5701
5702
  * Error thrown when there is an error with the server code, for example, unavailability.
5702
5703
  */
5703
5704
  class ServerError extends AuthError {
5704
- constructor(errorCode, errorMessage, subError, errorNo) {
5705
+ constructor(errorCode, errorMessage, subError, errorNo, status) {
5705
5706
  super(errorCode, errorMessage, subError);
5706
5707
  this.name = "ServerError";
5707
5708
  this.errorNo = errorNo;
5709
+ this.status = status;
5708
5710
  Object.setPrototypeOf(this, ServerError.prototype);
5709
5711
  }
5710
5712
  }
5711
5713
 
5712
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5714
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5713
5715
 
5714
5716
  /*
5715
5717
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5807,7 +5809,7 @@
5807
5809
  }
5808
5810
  }
5809
5811
 
5810
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5812
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5811
5813
 
5812
5814
  /*
5813
5815
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5844,7 +5846,7 @@
5844
5846
  }
5845
5847
  }
5846
5848
 
5847
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5849
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5848
5850
  /*
5849
5851
  * Copyright (c) Microsoft Corporation. All rights reserved.
5850
5852
  * Licensed under the MIT License.
@@ -5854,7 +5856,7 @@
5854
5856
  UPN: "UPN",
5855
5857
  };
5856
5858
 
5857
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5859
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5858
5860
 
5859
5861
  /*
5860
5862
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5919,26 +5921,9 @@
5919
5921
  throw createClientConfigurationError(invalidCodeChallengeMethod);
5920
5922
  }
5921
5923
  }
5922
- /**
5923
- * Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
5924
- * @param request
5925
- */
5926
- static sanitizeEQParams(eQParams, queryParams) {
5927
- if (!eQParams) {
5928
- return {};
5929
- }
5930
- // Remove any query parameters already included in SSO params
5931
- queryParams.forEach((_value, key) => {
5932
- if (eQParams[key]) {
5933
- delete eQParams[key];
5934
- }
5935
- });
5936
- // remove empty string parameters
5937
- return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
5938
- }
5939
5924
  }
5940
5925
 
5941
- /*! @azure/msal-common v14.12.0 2024-06-10 */
5926
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
5942
5927
 
5943
5928
  /*
5944
5929
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6226,9 +6211,10 @@
6226
6211
  * @param eQParams
6227
6212
  */
6228
6213
  addExtraQueryParameters(eQParams) {
6229
- const sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
6230
- Object.keys(sanitizedEQParams).forEach((key) => {
6231
- this.parameters.set(key, eQParams[key]);
6214
+ Object.entries(eQParams).forEach(([key, value]) => {
6215
+ if (!this.parameters.has(key) && value) {
6216
+ this.parameters.set(key, value);
6217
+ }
6232
6218
  });
6233
6219
  }
6234
6220
  addClientCapabilitiesToClaims(claims, clientCapabilities) {
@@ -6322,7 +6308,7 @@
6322
6308
  }
6323
6309
  }
6324
6310
 
6325
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6311
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6326
6312
 
6327
6313
  /*
6328
6314
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6425,7 +6411,7 @@
6425
6411
  }
6426
6412
  }
6427
6413
 
6428
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6414
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6429
6415
  /*
6430
6416
  * Copyright (c) Microsoft Corporation. All rights reserved.
6431
6417
  * Licensed under the MIT License.
@@ -6451,7 +6437,7 @@
6451
6437
  refreshTokenExpired: refreshTokenExpired
6452
6438
  });
6453
6439
 
6454
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6440
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6455
6441
 
6456
6442
  /*
6457
6443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6539,23 +6525,7 @@
6539
6525
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6540
6526
  }
6541
6527
 
6542
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6543
- /*
6544
- * Copyright (c) Microsoft Corporation. All rights reserved.
6545
- * Licensed under the MIT License.
6546
- */
6547
- /** @internal */
6548
- class CacheRecord {
6549
- constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
6550
- this.account = accountEntity || null;
6551
- this.idToken = idTokenEntity || null;
6552
- this.accessToken = accessTokenEntity || null;
6553
- this.refreshToken = refreshTokenEntity || null;
6554
- this.appMetadata = appMetadataEntity || null;
6555
- }
6556
- }
6557
-
6558
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6528
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6559
6529
 
6560
6530
  /*
6561
6531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6627,7 +6597,7 @@
6627
6597
  }
6628
6598
  }
6629
6599
 
6630
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6600
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6631
6601
 
6632
6602
  /*
6633
6603
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6711,7 +6681,7 @@
6711
6681
  }
6712
6682
  }
6713
6683
 
6714
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6684
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6715
6685
  /*
6716
6686
  * Copyright (c) Microsoft Corporation. All rights reserved.
6717
6687
  * Licensed under the MIT License.
@@ -6738,7 +6708,7 @@
6738
6708
  }
6739
6709
  }
6740
6710
 
6741
- /*! @azure/msal-common v14.12.0 2024-06-10 */
6711
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
6742
6712
 
6743
6713
  /*
6744
6714
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6815,11 +6785,11 @@
6815
6785
  if (serverResponse.error ||
6816
6786
  serverResponse.error_description ||
6817
6787
  serverResponse.suberror) {
6818
- const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
6788
+ 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}`;
6819
6789
  const serverErrorNo = serverResponse.error_codes?.length
6820
6790
  ? serverResponse.error_codes[0]
6821
6791
  : undefined;
6822
- const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
6792
+ const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
6823
6793
  // check if 500 error
6824
6794
  if (refreshAccessToken &&
6825
6795
  serverResponse.status &&
@@ -6933,7 +6903,7 @@
6933
6903
  let cachedAccount;
6934
6904
  if (serverTokenResponse.id_token && !!idTokenClaims) {
6935
6905
  cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
6936
- cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, idTokenClaims, this.cryptoObj.base64Decode, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6906
+ cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
6937
6907
  this.logger);
6938
6908
  }
6939
6909
  // AccessToken
@@ -6986,7 +6956,13 @@
6986
6956
  familyId: serverTokenResponse.foci,
6987
6957
  };
6988
6958
  }
6989
- return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
6959
+ return {
6960
+ account: cachedAccount,
6961
+ idToken: cachedIdToken,
6962
+ accessToken: cachedAccessToken,
6963
+ refreshToken: cachedRefreshToken,
6964
+ appMetadata: cachedAppMetadata,
6965
+ };
6990
6966
  }
6991
6967
  /**
6992
6968
  * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
@@ -7075,7 +7051,7 @@
7075
7051
  };
7076
7052
  }
7077
7053
  }
7078
- function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7054
+ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
7079
7055
  logger?.verbose("setCachedAccount called");
7080
7056
  // Check if base account is already cached
7081
7057
  const accountKeys = cacheStorage.getAccountKeys();
@@ -7098,6 +7074,7 @@
7098
7074
  }, authority, base64Decode);
7099
7075
  const tenantProfiles = baseAccount.tenantProfiles || [];
7100
7076
  if (claimsTenantId &&
7077
+ idTokenClaims &&
7101
7078
  !tenantProfiles.find((tenantProfile) => {
7102
7079
  return tenantProfile.tenantId === claimsTenantId;
7103
7080
  })) {
@@ -7108,7 +7085,7 @@
7108
7085
  return baseAccount;
7109
7086
  }
7110
7087
 
7111
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7088
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7112
7089
 
7113
7090
  /*
7114
7091
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7531,7 +7508,7 @@
7531
7508
  }
7532
7509
  }
7533
7510
 
7534
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7511
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7535
7512
 
7536
7513
  /*
7537
7514
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7745,7 +7722,7 @@
7745
7722
  }
7746
7723
  }
7747
7724
 
7748
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7725
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7749
7726
 
7750
7727
  /*
7751
7728
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7881,7 +7858,7 @@
7881
7858
  }
7882
7859
  }
7883
7860
 
7884
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7861
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7885
7862
 
7886
7863
  /*
7887
7864
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7896,7 +7873,7 @@
7896
7873
  },
7897
7874
  };
7898
7875
 
7899
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7876
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7900
7877
  /*
7901
7878
  * Copyright (c) Microsoft Corporation. All rights reserved.
7902
7879
  * Licensed under the MIT License.
@@ -7904,7 +7881,7 @@
7904
7881
  const missingKidError = "missing_kid_error";
7905
7882
  const missingAlgError = "missing_alg_error";
7906
7883
 
7907
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7884
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7908
7885
 
7909
7886
  /*
7910
7887
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7929,7 +7906,7 @@
7929
7906
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
7930
7907
  }
7931
7908
 
7932
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7909
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7933
7910
 
7934
7911
  /*
7935
7912
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7969,7 +7946,7 @@
7969
7946
  }
7970
7947
  }
7971
7948
 
7972
- /*! @azure/msal-common v14.12.0 2024-06-10 */
7949
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
7973
7950
 
7974
7951
  /*
7975
7952
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8027,7 +8004,7 @@
8027
8004
  }
8028
8005
  }
8029
8006
 
8030
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8007
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
8031
8008
 
8032
8009
  /*
8033
8010
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8231,7 +8208,7 @@
8231
8208
  }
8232
8209
  }
8233
8210
 
8234
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8211
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
8235
8212
 
8236
8213
  /*
8237
8214
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8310,7 +8287,7 @@
8310
8287
  }
8311
8288
  }
8312
8289
 
8313
- /*! @azure/msal-common v14.12.0 2024-06-10 */
8290
+ /*! @azure/msal-common v14.13.0 2024-07-12 */
8314
8291
 
8315
8292
  /*
8316
8293
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10181,7 +10158,7 @@
10181
10158
 
10182
10159
  /* eslint-disable header/header */
10183
10160
  const name = "@azure/msal-browser";
10184
- const version = "3.17.0";
10161
+ const version = "3.19.0";
10185
10162
 
10186
10163
  /*
10187
10164
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12037,10 +12014,11 @@
12037
12014
  /**
12038
12015
  * Clears all access tokes that have claims prior to saving the current one
12039
12016
  * @param performanceClient {IPerformanceClient}
12017
+ * @param correlationId {string} correlation id
12040
12018
  * @returns
12041
12019
  */
12042
- async clearTokensAndKeysWithClaims(performanceClient) {
12043
- performanceClient.addQueueMeasurement(PerformanceEvents.ClearTokensAndKeysWithClaims);
12020
+ async clearTokensAndKeysWithClaims(performanceClient, correlationId) {
12021
+ performanceClient.addQueueMeasurement(PerformanceEvents.ClearTokensAndKeysWithClaims, correlationId);
12044
12022
  const tokenKeys = this.getTokenKeys();
12045
12023
  const removedAccessTokens = [];
12046
12024
  tokenKeys.accessToken.forEach((key) => {
@@ -12441,7 +12419,10 @@
12441
12419
  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
12442
12420
  result.tokenType, undefined, // userAssertionHash
12443
12421
  request.sshKid, request.claims, claimsHash);
12444
- const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
12422
+ const cacheRecord = {
12423
+ idToken: idTokenEntity,
12424
+ accessToken: accessTokenEntity,
12425
+ };
12445
12426
  return this.saveCacheRecord(cacheRecord);
12446
12427
  }
12447
12428
  /**
@@ -13437,11 +13418,12 @@
13437
13418
  */
13438
13419
  async acquireTokenRedirect(request, rootMeasurement) {
13439
13420
  this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");
13440
- const nativeRequest = await this.initializeNativeRequest(request);
13441
- const { ...nativeTokenRequest } = nativeRequest;
13421
+ const { ...remainingParameters } = request;
13422
+ delete remainingParameters.onRedirectNavigate;
13423
+ const nativeRequest = await this.initializeNativeRequest(remainingParameters);
13442
13424
  const messageBody = {
13443
13425
  method: NativeExtensionMethod.GetToken,
13444
- request: nativeTokenRequest,
13426
+ request: nativeRequest,
13445
13427
  };
13446
13428
  try {
13447
13429
  const response = await this.nativeMessageHandler.sendMessage(messageBody);
@@ -13537,7 +13519,7 @@
13537
13519
  }
13538
13520
  // Get the preferred_cache domain for the given authority
13539
13521
  const authority = await this.getDiscoveredAuthority(request.authority);
13540
- const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, idTokenClaims, base64Decode, response.client_info, undefined, // environment
13522
+ const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
13541
13523
  idTokenClaims.tid, undefined, // auth code payload
13542
13524
  response.account.id, this.logger);
13543
13525
  // generate authenticationResult
@@ -13697,7 +13679,10 @@
13697
13679
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13698
13680
  const responseScopes = this.generateScopes(response, request);
13699
13681
  const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
13700
- const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
13682
+ const nativeCacheRecord = {
13683
+ idToken: cachedIdToken,
13684
+ accessToken: cachedAccessToken,
13685
+ };
13701
13686
  void this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
13702
13687
  }
13703
13688
  addTelemetryFromNativeResponse(response) {
@@ -15465,47 +15450,32 @@
15465
15450
  * @returns `AuthenticationResult` for the response that was loaded.
15466
15451
  */
15467
15452
  loadExternalTokens(request, response, options) {
15468
- this.logger.info("TokenCache - loadExternalTokens called");
15469
- if (!response.id_token) {
15470
- throw createBrowserAuthError(unableToLoadToken);
15453
+ if (!this.isBrowserEnvironment) {
15454
+ throw createBrowserAuthError(nonBrowserEnvironment);
15471
15455
  }
15472
- const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
15473
- let cacheRecord;
15474
- let authority;
15475
- let cacheRecordAccount;
15476
- if (request.account) {
15477
- cacheRecordAccount = AccountEntity.createFromAccountInfo(request.account);
15478
- 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));
15479
- }
15480
- else if (request.authority) {
15481
- const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
15482
- const authorityOptions = {
15483
- protocolMode: this.config.auth.protocolMode,
15484
- knownAuthorities: this.config.auth.knownAuthorities,
15485
- cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15486
- authorityMetadata: this.config.auth.authorityMetadata,
15487
- skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15488
- };
15489
- authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid());
15490
- // "clientInfo" from options takes precedence over "clientInfo" in response
15491
- if (options.clientInfo) {
15492
- this.logger.trace("TokenCache - homeAccountId from options");
15493
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, options.clientInfo);
15494
- 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));
15495
- }
15496
- else if (response.client_info) {
15497
- this.logger.trace("TokenCache - homeAccountId from response");
15498
- cacheRecordAccount = this.loadAccount(idTokenClaims, authority, response.client_info);
15499
- 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));
15500
- }
15501
- else {
15502
- throw createBrowserAuthError(unableToLoadToken);
15503
- }
15504
- }
15505
- else {
15506
- throw createBrowserAuthError(unableToLoadToken);
15507
- }
15508
- return this.generateAuthenticationResult(request, idTokenClaims, cacheRecord, cacheRecordAccount, authority);
15456
+ const idTokenClaims = response.id_token
15457
+ ? extractTokenClaims(response.id_token, base64Decode)
15458
+ : undefined;
15459
+ const authorityOptions = {
15460
+ protocolMode: this.config.auth.protocolMode,
15461
+ knownAuthorities: this.config.auth.knownAuthorities,
15462
+ cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
15463
+ authorityMetadata: this.config.auth.authorityMetadata,
15464
+ skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
15465
+ };
15466
+ const authority = request.authority
15467
+ ? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
15468
+ : undefined;
15469
+ const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
15470
+ const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
15471
+ const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
15472
+ const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
15473
+ return this.generateAuthenticationResult(request, {
15474
+ account: cacheRecordAccount,
15475
+ idToken,
15476
+ accessToken,
15477
+ refreshToken,
15478
+ }, idTokenClaims, authority);
15509
15479
  }
15510
15480
  /**
15511
15481
  * Helper function to load account to msal-browser cache
@@ -15516,29 +15486,24 @@
15516
15486
  * @param requestHomeAccountId
15517
15487
  * @returns `AccountEntity`
15518
15488
  */
15519
- loadAccount(idTokenClaims, authority, clientInfo, requestHomeAccountId) {
15520
- if (this.isBrowserEnvironment) {
15521
- this.logger.verbose("TokenCache - loading account");
15522
- let homeAccountId;
15523
- if (requestHomeAccountId) {
15524
- homeAccountId = requestHomeAccountId;
15525
- }
15526
- else if (authority.authorityType !== undefined && clientInfo) {
15527
- homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15528
- }
15529
- if (!homeAccountId) {
15530
- throw createBrowserAuthError(unableToLoadToken);
15531
- }
15532
- const claimsTenantId = idTokenClaims.tid;
15533
- const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, idTokenClaims, base64Decode, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15534
- undefined, // nativeAccountId
15535
- this.logger);
15536
- this.storage.setAccount(cachedAccount);
15537
- return cachedAccount;
15489
+ loadAccount(request, clientInfo, idTokenClaims, authority) {
15490
+ this.logger.verbose("TokenCache - loading account");
15491
+ if (request.account) {
15492
+ const accountEntity = AccountEntity.createFromAccountInfo(request.account);
15493
+ this.storage.setAccount(accountEntity);
15494
+ return accountEntity;
15538
15495
  }
15539
- else {
15496
+ else if (!authority || (!clientInfo && !idTokenClaims)) {
15497
+ this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead.");
15540
15498
  throw createBrowserAuthError(unableToLoadToken);
15541
15499
  }
15500
+ const homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idTokenClaims);
15501
+ const claimsTenantId = idTokenClaims?.tid;
15502
+ const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
15503
+ undefined, // nativeAccountId
15504
+ this.logger);
15505
+ this.storage.setAccount(cachedAccount);
15506
+ return cachedAccount;
15542
15507
  }
15543
15508
  /**
15544
15509
  * Helper function to load id tokens to msal-browser cache
@@ -15548,16 +15513,15 @@
15548
15513
  * @param tenantId
15549
15514
  * @returns `IdTokenEntity`
15550
15515
  */
15551
- loadIdToken(idToken, homeAccountId, environment, tenantId) {
15552
- const idTokenEntity = createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
15553
- if (this.isBrowserEnvironment) {
15554
- this.logger.verbose("TokenCache - loading id token");
15555
- this.storage.setIdTokenCredential(idTokenEntity);
15556
- return idTokenEntity;
15557
- }
15558
- else {
15559
- throw createBrowserAuthError(unableToLoadToken);
15516
+ loadIdToken(response, homeAccountId, environment, tenantId) {
15517
+ if (!response.id_token) {
15518
+ this.logger.verbose("TokenCache - no id token found in response");
15519
+ return null;
15560
15520
  }
15521
+ this.logger.verbose("TokenCache - loading id token");
15522
+ const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
15523
+ this.storage.setIdTokenCredential(idTokenEntity);
15524
+ return idTokenEntity;
15561
15525
  }
15562
15526
  /**
15563
15527
  * Helper function to load access tokens to msal-browser cache
@@ -15570,28 +15534,30 @@
15570
15534
  */
15571
15535
  loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
15572
15536
  if (!response.access_token) {
15573
- this.logger.verbose("TokenCache - No access token provided for caching");
15537
+ this.logger.verbose("TokenCache - no access token found in response");
15574
15538
  return null;
15575
15539
  }
15576
- if (!response.expires_in) {
15577
- throw createBrowserAuthError(unableToLoadToken);
15540
+ else if (!response.expires_in) {
15541
+ this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache.");
15542
+ return null;
15578
15543
  }
15579
- if (!options.extendedExpiresOn) {
15580
- throw createBrowserAuthError(unableToLoadToken);
15544
+ else if (!response.scope &&
15545
+ (!request.scopes || !request.scopes.length)) {
15546
+ this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache.");
15547
+ return null;
15581
15548
  }
15582
- const scopes = new ScopeSet(request.scopes).printScopes();
15549
+ this.logger.verbose("TokenCache - loading access token");
15550
+ const scopes = response.scope
15551
+ ? ScopeSet.fromString(response.scope)
15552
+ : new ScopeSet(request.scopes);
15583
15553
  const expiresOn = options.expiresOn ||
15584
15554
  response.expires_in + new Date().getTime() / 1000;
15585
- const extendedExpiresOn = options.extendedExpiresOn;
15586
- const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, base64Decode);
15587
- if (this.isBrowserEnvironment) {
15588
- this.logger.verbose("TokenCache - loading access token");
15589
- this.storage.setAccessTokenCredential(accessTokenEntity);
15590
- return accessTokenEntity;
15591
- }
15592
- else {
15593
- throw createBrowserAuthError(unableToLoadToken);
15594
- }
15555
+ const extendedExpiresOn = options.extendedExpiresOn ||
15556
+ (response.ext_expires_in || response.expires_in) +
15557
+ new Date().getTime() / 1000;
15558
+ const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
15559
+ this.storage.setAccessTokenCredential(accessTokenEntity);
15560
+ return accessTokenEntity;
15595
15561
  }
15596
15562
  /**
15597
15563
  * Helper function to load refresh tokens to msal-browser cache
@@ -15601,20 +15567,16 @@
15601
15567
  * @param environment
15602
15568
  * @returns `RefreshTokenEntity`
15603
15569
  */
15604
- loadRefreshToken(request, response, homeAccountId, environment) {
15570
+ loadRefreshToken(response, homeAccountId, environment) {
15605
15571
  if (!response.refresh_token) {
15606
- this.logger.verbose("TokenCache - No refresh token provided for caching");
15572
+ this.logger.verbose("TokenCache - no refresh token found in response");
15607
15573
  return null;
15608
15574
  }
15609
- const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);
15610
- if (this.isBrowserEnvironment) {
15611
- this.logger.verbose("TokenCache - loading refresh token");
15612
- this.storage.setRefreshTokenCredential(refreshTokenEntity);
15613
- return refreshTokenEntity;
15614
- }
15615
- else {
15616
- throw createBrowserAuthError(unableToLoadToken);
15617
- }
15575
+ this.logger.verbose("TokenCache - loading refresh token");
15576
+ const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
15577
+ response.refresh_token_expires_in);
15578
+ this.storage.setRefreshTokenCredential(refreshTokenEntity);
15579
+ return refreshTokenEntity;
15618
15580
  }
15619
15581
  /**
15620
15582
  * Helper function to generate an `AuthenticationResult` for the result.
@@ -15624,8 +15586,8 @@
15624
15586
  * @param authority
15625
15587
  * @returns `AuthenticationResult`
15626
15588
  */
15627
- generateAuthenticationResult(request, idTokenClaims, cacheRecord, accountEntity, authority) {
15628
- let accessToken = Constants.EMPTY_STRING;
15589
+ generateAuthenticationResult(request, cacheRecord, idTokenClaims, authority) {
15590
+ let accessToken = "";
15629
15591
  let responseScopes = [];
15630
15592
  let expiresOn = null;
15631
15593
  let extExpiresOn;
@@ -15635,14 +15597,11 @@
15635
15597
  expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
15636
15598
  extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
15637
15599
  }
15638
- const uid = idTokenClaims.oid || idTokenClaims.sub || Constants.EMPTY_STRING;
15639
- const tid = idTokenClaims.tid || Constants.EMPTY_STRING;
15600
+ const accountEntity = cacheRecord.account;
15640
15601
  return {
15641
- authority: authority
15642
- ? authority.canonicalAuthority
15643
- : Constants.EMPTY_STRING,
15644
- uniqueId: uid,
15645
- tenantId: tid,
15602
+ authority: authority ? authority.canonicalAuthority : "",
15603
+ uniqueId: cacheRecord.account.localAccountId,
15604
+ tenantId: cacheRecord.account.realm,
15646
15605
  scopes: responseScopes,
15647
15606
  account: accountEntity.getAccountInfo(),
15648
15607
  idToken: cacheRecord.idToken?.secret || "",
@@ -15650,15 +15609,14 @@
15650
15609
  accessToken: accessToken,
15651
15610
  fromCache: true,
15652
15611
  expiresOn: expiresOn,
15653
- correlationId: request.correlationId || Constants.EMPTY_STRING,
15654
- requestId: Constants.EMPTY_STRING,
15612
+ correlationId: request.correlationId || "",
15613
+ requestId: "",
15655
15614
  extExpiresOn: extExpiresOn,
15656
- familyId: Constants.EMPTY_STRING,
15657
- tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,
15658
- state: Constants.EMPTY_STRING,
15659
- cloudGraphHostName: accountEntity.cloudGraphHostName || Constants.EMPTY_STRING,
15660
- msGraphHost: accountEntity.msGraphHost || Constants.EMPTY_STRING,
15661
- code: undefined,
15615
+ familyId: cacheRecord.refreshToken?.familyId || "",
15616
+ tokenType: cacheRecord?.accessToken?.tokenType || "",
15617
+ state: request.state || "",
15618
+ cloudGraphHostName: accountEntity.cloudGraphHostName || "",
15619
+ msGraphHost: accountEntity.msGraphHost || "",
15662
15620
  fromNativeBroker: false,
15663
15621
  };
15664
15622
  }
@@ -15828,9 +15786,9 @@
15828
15786
  this.trackPageVisibilityWithMeasurement =
15829
15787
  this.trackPageVisibilityWithMeasurement.bind(this);
15830
15788
  }
15831
- static async createController(operatingContext) {
15789
+ static async createController(operatingContext, request) {
15832
15790
  const controller = new StandardController(operatingContext);
15833
- await controller.initialize();
15791
+ await controller.initialize(request);
15834
15792
  return controller;
15835
15793
  }
15836
15794
  trackPageVisibility(correlationId) {
@@ -15842,15 +15800,17 @@
15842
15800
  }
15843
15801
  /**
15844
15802
  * Initializer function to perform async startup tasks such as connecting to WAM extension
15803
+ * @param request {?InitializeApplicationRequest} correlation id
15845
15804
  */
15846
- async initialize() {
15805
+ async initialize(request) {
15847
15806
  this.logger.trace("initialize called");
15848
15807
  if (this.initialized) {
15849
15808
  this.logger.info("initialize has already been called, exiting early.");
15850
15809
  return;
15851
15810
  }
15811
+ const initCorrelationId = request?.correlationId || this.getRequestCorrelationId();
15852
15812
  const allowNativeBroker = this.config.system.allowNativeBroker;
15853
- const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication);
15813
+ const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication, initCorrelationId);
15854
15814
  this.eventHandler.emitEvent(EventType.INITIALIZE_START);
15855
15815
  if (allowNativeBroker) {
15856
15816
  try {
@@ -15863,7 +15823,7 @@
15863
15823
  }
15864
15824
  if (!this.config.cache.claimsBasedCachingEnabled) {
15865
15825
  this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims");
15866
- await invokeAsync(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage), PerformanceEvents.ClearTokensAndKeysWithClaims, this.logger, this.performanceClient)(this.performanceClient);
15826
+ await invokeAsync(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage), PerformanceEvents.ClearTokensAndKeysWithClaims, this.logger, this.performanceClient, initCorrelationId)(this.performanceClient, initCorrelationId);
15867
15827
  }
15868
15828
  this.initialized = true;
15869
15829
  this.eventHandler.emitEvent(EventType.INITIALIZE_END);
@@ -16900,12 +16860,13 @@
16900
16860
  * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
16901
16861
  */
16902
16862
  async acquireTokenSilentAsync(request, account) {
16863
+ const trackPageVisibility = () => this.trackPageVisibility(request.correlationId);
16903
16864
  this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
16904
16865
  this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
16905
16866
  if (request.correlationId) {
16906
16867
  this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
16907
16868
  }
16908
- document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16869
+ document.addEventListener("visibilitychange", trackPageVisibility);
16909
16870
  const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
16910
16871
  const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
16911
16872
  const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
@@ -16984,7 +16945,7 @@
16984
16945
  throw tokenRenewalError;
16985
16946
  })
16986
16947
  .finally(() => {
16987
- document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
16948
+ document.removeEventListener("visibilitychange", trackPageVisibility);
16988
16949
  });
16989
16950
  }
16990
16951
  /**
@@ -17245,7 +17206,7 @@
17245
17206
  const NestedAppAuthErrorMessage = {
17246
17207
  unsupportedMethod: {
17247
17208
  code: "unsupported_method",
17248
- desc: "The PKCE code challenge and verifier could not be generated.",
17209
+ desc: "This method is not supported in nested app environment.",
17249
17210
  },
17250
17211
  };
17251
17212
  class NestedAppAuthError extends AuthError {
@@ -17737,10 +17698,10 @@
17737
17698
  * Copyright (c) Microsoft Corporation. All rights reserved.
17738
17699
  * Licensed under the MIT License.
17739
17700
  */
17740
- async function createV3Controller(config) {
17701
+ async function createV3Controller(config, request) {
17741
17702
  const standard = new StandardOperatingContext(config);
17742
17703
  await standard.initialize();
17743
- return StandardController.createController(standard);
17704
+ return StandardController.createController(standard, request);
17744
17705
  }
17745
17706
  async function createController(config) {
17746
17707
  const standard = new StandardOperatingContext(config);
@@ -17768,7 +17729,11 @@
17768
17729
  * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.
17769
17730
  */
17770
17731
  class PublicClientApplication {
17771
- // creates StandardController and passes it to the PublicClientApplication
17732
+ /**
17733
+ * Creates StandardController and passes it to the PublicClientApplication
17734
+ *
17735
+ * @param configuration {Configuration}
17736
+ */
17772
17737
  static async createPublicClientApplication(configuration) {
17773
17738
  const controller = await createV3Controller(configuration);
17774
17739
  const pca = new PublicClientApplication(configuration, controller);
@@ -17803,9 +17768,10 @@
17803
17768
  }
17804
17769
  /**
17805
17770
  * Initializer function to perform async startup tasks such as connecting to WAM extension
17771
+ * @param request {?InitializeApplicationRequest}
17806
17772
  */
17807
- async initialize() {
17808
- return this.controller.initialize();
17773
+ async initialize(request) {
17774
+ return this.controller.initialize(request);
17809
17775
  }
17810
17776
  /**
17811
17777
  * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser