@azure/msal-browser 2.19.0 → 2.20.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 (95) hide show
  1. package/CHANGELOG.json +43 -0
  2. package/CHANGELOG.md +14 -1
  3. package/README.md +3 -1
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.d.ts +19 -0
  6. package/dist/app/ClientApplication.d.ts.map +1 -1
  7. package/dist/app/ClientApplication.js +76 -1
  8. package/dist/app/ClientApplication.js.map +1 -1
  9. package/dist/app/IPublicClientApplication.d.ts +2 -0
  10. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  11. package/dist/app/IPublicClientApplication.js +4 -1
  12. package/dist/app/IPublicClientApplication.js.map +1 -1
  13. package/dist/app/PublicClientApplication.js +1 -1
  14. package/dist/cache/AsyncMemoryStorage.d.ts +1 -1
  15. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
  16. package/dist/cache/AsyncMemoryStorage.js +2 -2
  17. package/dist/cache/AsyncMemoryStorage.js.map +1 -1
  18. package/dist/cache/BrowserCacheManager.js +1 -1
  19. package/dist/cache/BrowserStorage.js +1 -1
  20. package/dist/cache/DatabaseStorage.js +1 -1
  21. package/dist/cache/MemoryStorage.js +1 -1
  22. package/dist/cache/TokenCache.js +1 -1
  23. package/dist/config/Configuration.js +1 -1
  24. package/dist/crypto/BrowserCrypto.js +1 -1
  25. package/dist/crypto/CryptoOps.js +1 -1
  26. package/dist/crypto/GuidGenerator.js +1 -1
  27. package/dist/crypto/PkceGenerator.js +1 -1
  28. package/dist/crypto/SignedHttpRequest.js +1 -1
  29. package/dist/encode/Base64Decode.js +1 -1
  30. package/dist/encode/Base64Encode.js +1 -1
  31. package/dist/error/BrowserAuthError.d.ts +8 -0
  32. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  33. package/dist/error/BrowserAuthError.js +11 -1
  34. package/dist/error/BrowserAuthError.js.map +1 -1
  35. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  36. package/dist/event/EventHandler.js +1 -1
  37. package/dist/event/EventMessage.js +1 -1
  38. package/dist/event/EventType.d.ts +3 -0
  39. package/dist/event/EventType.d.ts.map +1 -1
  40. package/dist/event/EventType.js +4 -1
  41. package/dist/event/EventType.js.map +1 -1
  42. package/dist/index.cjs.js +300 -77
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  48. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +5 -0
  49. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -0
  50. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +21 -0
  51. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -0
  52. package/dist/interaction_client/PopupClient.js +2 -2
  53. package/dist/interaction_client/PopupClient.js.map +1 -1
  54. package/dist/interaction_client/RedirectClient.js +2 -2
  55. package/dist/interaction_client/RedirectClient.js.map +1 -1
  56. package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -0
  57. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -0
  58. package/dist/interaction_client/SilentAuthCodeClient.js +80 -0
  59. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -0
  60. package/dist/interaction_client/SilentCacheClient.js +1 -1
  61. package/dist/interaction_client/SilentIframeClient.js +2 -2
  62. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  63. package/dist/interaction_client/SilentRefreshClient.js +1 -1
  64. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  65. package/dist/interaction_handler/InteractionHandler.d.ts +11 -2
  66. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  67. package/dist/interaction_handler/InteractionHandler.js +36 -10
  68. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  69. package/dist/interaction_handler/PopupHandler.js +1 -1
  70. package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
  71. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  72. package/dist/interaction_handler/RedirectHandler.js +2 -2
  73. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  74. package/dist/interaction_handler/SilentHandler.js +1 -1
  75. package/dist/navigation/NavigationClient.js +1 -1
  76. package/dist/network/FetchClient.js +1 -1
  77. package/dist/network/XhrClient.js +1 -1
  78. package/dist/packageMetadata.d.ts +1 -1
  79. package/dist/packageMetadata.js +2 -2
  80. package/dist/packageMetadata.js.map +1 -1
  81. package/dist/request/AuthorizationCodeRequest.d.ts +8 -0
  82. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  83. package/dist/utils/BrowserConstants.d.ts +1 -0
  84. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  85. package/dist/utils/BrowserConstants.js +2 -1
  86. package/dist/utils/BrowserConstants.js.map +1 -1
  87. package/dist/utils/BrowserProtocolUtils.js +1 -1
  88. package/dist/utils/BrowserStringUtils.js +1 -1
  89. package/dist/utils/BrowserUtils.js +1 -1
  90. package/dist/utils/MathUtils.js +1 -1
  91. package/dist/utils/PopupUtils.js +1 -1
  92. package/lib/msal-browser.js +300 -77
  93. package/lib/msal-browser.js.map +1 -1
  94. package/lib/msal-browser.min.js +27 -27
  95. package/package.json +3 -2
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.19.0 2021-11-02 */
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -105,7 +105,7 @@ function __spread() {
105
105
  return ar;
106
106
  }
107
107
 
108
- /*! @azure/msal-common v5.1.0 2021-11-02 */
108
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
109
109
  /*! *****************************************************************************
110
110
  Copyright (c) Microsoft Corporation.
111
111
 
@@ -192,7 +192,7 @@ function __spreadArrays() {
192
192
  return r;
193
193
  }
194
194
 
195
- /*! @azure/msal-common v5.1.0 2021-11-02 */
195
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
196
196
 
197
197
  /*
198
198
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -329,6 +329,7 @@ var AADServerParamKeys;
329
329
  AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
330
330
  AADServerParamKeys["FOCI"] = "foci";
331
331
  AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
332
+ AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
332
333
  })(AADServerParamKeys || (AADServerParamKeys = {}));
333
334
  /**
334
335
  * Claims request keys
@@ -553,7 +554,7 @@ var CacheOutcome;
553
554
  CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
554
555
  })(CacheOutcome || (CacheOutcome = {}));
555
556
 
556
- /*! @azure/msal-common v5.1.0 2021-11-02 */
557
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
557
558
 
558
559
  /*
559
560
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -597,7 +598,7 @@ var AuthError = /** @class */ (function (_super) {
597
598
  return AuthError;
598
599
  }(Error));
599
600
 
600
- /*! @azure/msal-common v5.1.0 2021-11-02 */
601
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
601
602
 
602
603
  /*
603
604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -663,7 +664,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
663
664
  }
664
665
  };
665
666
 
666
- /*! @azure/msal-common v5.1.0 2021-11-02 */
667
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
667
668
 
668
669
  /*
669
670
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1125,7 +1126,7 @@ var ClientAuthError = /** @class */ (function (_super) {
1125
1126
  return ClientAuthError;
1126
1127
  }(AuthError));
1127
1128
 
1128
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1129
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1129
1130
 
1130
1131
  /*
1131
1132
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1250,7 +1251,7 @@ var StringUtils = /** @class */ (function () {
1250
1251
  return StringUtils;
1251
1252
  }());
1252
1253
 
1253
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1254
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1254
1255
 
1255
1256
  /*
1256
1257
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1430,12 +1431,12 @@ var Logger = /** @class */ (function () {
1430
1431
  return Logger;
1431
1432
  }());
1432
1433
 
1433
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1434
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1434
1435
  /* eslint-disable header/header */
1435
1436
  var name$1 = "@azure/msal-common";
1436
- var version$1 = "5.1.0";
1437
+ var version$1 = "5.2.0";
1437
1438
 
1438
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1439
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1439
1440
 
1440
1441
  /*
1441
1442
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1579,7 +1580,7 @@ var CredentialEntity = /** @class */ (function () {
1579
1580
  return CredentialEntity;
1580
1581
  }());
1581
1582
 
1582
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1583
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1583
1584
 
1584
1585
  /*
1585
1586
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1824,7 +1825,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
1824
1825
  return ClientConfigurationError;
1825
1826
  }(ClientAuthError));
1826
1827
 
1827
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1828
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1828
1829
 
1829
1830
  /*
1830
1831
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2008,7 +2009,7 @@ var ScopeSet = /** @class */ (function () {
2008
2009
  return ScopeSet;
2009
2010
  }());
2010
2011
 
2011
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2012
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2012
2013
 
2013
2014
  /*
2014
2015
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2046,7 +2047,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2046
2047
  };
2047
2048
  }
2048
2049
 
2049
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2050
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2050
2051
  /*
2051
2052
  * Copyright (c) Microsoft Corporation. All rights reserved.
2052
2053
  * Licensed under the MIT License.
@@ -2060,7 +2061,7 @@ var AuthorityType;
2060
2061
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2061
2062
  })(AuthorityType || (AuthorityType = {}));
2062
2063
 
2063
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2064
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2064
2065
 
2065
2066
  /*
2066
2067
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2294,7 +2295,7 @@ var AccountEntity = /** @class */ (function () {
2294
2295
  return AccountEntity;
2295
2296
  }());
2296
2297
 
2297
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2298
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2298
2299
 
2299
2300
  /*
2300
2301
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2332,7 +2333,7 @@ var AuthToken = /** @class */ (function () {
2332
2333
  return AuthToken;
2333
2334
  }());
2334
2335
 
2335
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2336
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2336
2337
 
2337
2338
  /*
2338
2339
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3164,7 +3165,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
3164
3165
  return DefaultStorageClass;
3165
3166
  }(CacheManager));
3166
3167
 
3167
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3168
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3168
3169
 
3169
3170
  /*
3170
3171
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3246,7 +3247,7 @@ function buildAuthOptions(authOptions) {
3246
3247
  return __assign({ clientCapabilities: [] }, authOptions);
3247
3248
  }
3248
3249
 
3249
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3250
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3250
3251
 
3251
3252
  /*
3252
3253
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3266,7 +3267,7 @@ var ServerError = /** @class */ (function (_super) {
3266
3267
  return ServerError;
3267
3268
  }(AuthError));
3268
3269
 
3269
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3270
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3270
3271
 
3271
3272
  /*
3272
3273
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3362,7 +3363,7 @@ var ThrottlingUtils = /** @class */ (function () {
3362
3363
  return ThrottlingUtils;
3363
3364
  }());
3364
3365
 
3365
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3366
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3366
3367
 
3367
3368
  /*
3368
3369
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3411,7 +3412,7 @@ var NetworkManager = /** @class */ (function () {
3411
3412
  return NetworkManager;
3412
3413
  }());
3413
3414
 
3414
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3415
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3415
3416
  /*
3416
3417
  * Copyright (c) Microsoft Corporation. All rights reserved.
3417
3418
  * Licensed under the MIT License.
@@ -3422,7 +3423,7 @@ var CcsCredentialType;
3422
3423
  CcsCredentialType["UPN"] = "UPN";
3423
3424
  })(CcsCredentialType || (CcsCredentialType = {}));
3424
3425
 
3425
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3426
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3426
3427
 
3427
3428
  /*
3428
3429
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3511,7 +3512,7 @@ var BaseClient = /** @class */ (function () {
3511
3512
  return BaseClient;
3512
3513
  }());
3513
3514
 
3514
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3515
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3515
3516
 
3516
3517
  /*
3517
3518
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3597,7 +3598,7 @@ var RequestValidator = /** @class */ (function () {
3597
3598
  return RequestValidator;
3598
3599
  }());
3599
3600
 
3600
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3601
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3601
3602
 
3602
3603
  /*
3603
3604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3937,7 +3938,7 @@ var RequestParameterBuilder = /** @class */ (function () {
3937
3938
  return RequestParameterBuilder;
3938
3939
  }());
3939
3940
 
3940
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3941
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3941
3942
 
3942
3943
  /*
3943
3944
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4002,7 +4003,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
4002
4003
  return IdTokenEntity;
4003
4004
  }(CredentialEntity));
4004
4005
 
4005
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4006
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4006
4007
  /*
4007
4008
  * Copyright (c) Microsoft Corporation. All rights reserved.
4008
4009
  * Licensed under the MIT License.
@@ -4052,7 +4053,7 @@ var TimeUtils = /** @class */ (function () {
4052
4053
  return TimeUtils;
4053
4054
  }());
4054
4055
 
4055
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4056
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4056
4057
 
4057
4058
  /*
4058
4059
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4159,7 +4160,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
4159
4160
  return AccessTokenEntity;
4160
4161
  }(CredentialEntity));
4161
4162
 
4162
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4163
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4163
4164
 
4164
4165
  /*
4165
4166
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4226,7 +4227,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
4226
4227
  return RefreshTokenEntity;
4227
4228
  }(CredentialEntity));
4228
4229
 
4229
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4230
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4230
4231
 
4231
4232
  /*
4232
4233
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4290,7 +4291,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
4290
4291
  return InteractionRequiredAuthError;
4291
4292
  }(AuthError));
4292
4293
 
4293
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4294
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4294
4295
  /*
4295
4296
  * Copyright (c) Microsoft Corporation. All rights reserved.
4296
4297
  * Licensed under the MIT License.
@@ -4306,7 +4307,7 @@ var CacheRecord = /** @class */ (function () {
4306
4307
  return CacheRecord;
4307
4308
  }());
4308
4309
 
4309
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4310
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4310
4311
 
4311
4312
  /*
4312
4313
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4377,7 +4378,7 @@ var ProtocolUtils = /** @class */ (function () {
4377
4378
  return ProtocolUtils;
4378
4379
  }());
4379
4380
 
4380
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4381
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4381
4382
 
4382
4383
  /*
4383
4384
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4578,7 +4579,7 @@ var UrlString = /** @class */ (function () {
4578
4579
  return UrlString;
4579
4580
  }());
4580
4581
 
4581
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4582
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4582
4583
 
4583
4584
  /*
4584
4585
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4653,7 +4654,7 @@ var PopTokenGenerator = /** @class */ (function () {
4653
4654
  return PopTokenGenerator;
4654
4655
  }());
4655
4656
 
4656
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4657
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4657
4658
 
4658
4659
  /*
4659
4660
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4723,7 +4724,7 @@ var AppMetadataEntity = /** @class */ (function () {
4723
4724
  return AppMetadataEntity;
4724
4725
  }());
4725
4726
 
4726
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4727
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4727
4728
  /*
4728
4729
  * Copyright (c) Microsoft Corporation. All rights reserved.
4729
4730
  * Licensed under the MIT License.
@@ -4759,7 +4760,7 @@ var AppMetadataEntity = /** @class */ (function () {
4759
4760
  return TokenCacheContext;
4760
4761
  }());
4761
4762
 
4762
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4763
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4763
4764
 
4764
4765
  /*
4765
4766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4879,7 +4880,7 @@ var ResponseHandler = /** @class */ (function () {
4879
4880
  _a.sent();
4880
4881
  _a.label = 7;
4881
4882
  case 7: return [7 /*endfinally*/];
4882
- case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
4883
+ case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code)];
4883
4884
  }
4884
4885
  });
4885
4886
  });
@@ -4965,7 +4966,7 @@ var ResponseHandler = /** @class */ (function () {
4965
4966
  * @param fromTokenCache
4966
4967
  * @param stateString
4967
4968
  */
4968
- ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState) {
4969
+ ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code) {
4969
4970
  var _a, _b, _c;
4970
4971
  return __awaiter(this, void 0, void 0, function () {
4971
4972
  var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;
@@ -5014,7 +5015,8 @@ var ResponseHandler = /** @class */ (function () {
5014
5015
  tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,
5015
5016
  state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,
5016
5017
  cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
5017
- msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING
5018
+ msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
5019
+ code: code
5018
5020
  }];
5019
5021
  }
5020
5022
  });
@@ -5023,7 +5025,7 @@ var ResponseHandler = /** @class */ (function () {
5023
5025
  return ResponseHandler;
5024
5026
  }());
5025
5027
 
5026
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5028
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5027
5029
 
5028
5030
  /*
5029
5031
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5035,7 +5037,10 @@ var ResponseHandler = /** @class */ (function () {
5035
5037
  var AuthorizationCodeClient = /** @class */ (function (_super) {
5036
5038
  __extends(AuthorizationCodeClient, _super);
5037
5039
  function AuthorizationCodeClient(configuration) {
5038
- return _super.call(this, configuration) || this;
5040
+ var _this = _super.call(this, configuration) || this;
5041
+ // Flag to indicate if client is for hybrid spa auth code redemption
5042
+ _this.includeRedirectUri = true;
5043
+ return _this;
5039
5044
  }
5040
5045
  /**
5041
5046
  * Creates the URL of the authorization request letting the user input credentials and consent to the
@@ -5184,13 +5189,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5184
5189
  AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
5185
5190
  return __awaiter(this, void 0, void 0, function () {
5186
5191
  var parameterBuilder, clientAssertion, popTokenGenerator, cnfString, correlationId, ccsCred, clientInfo, clientInfo;
5187
- return __generator(this, function (_a) {
5188
- switch (_a.label) {
5192
+ var _a;
5193
+ return __generator(this, function (_b) {
5194
+ switch (_b.label) {
5189
5195
  case 0:
5190
5196
  parameterBuilder = new RequestParameterBuilder();
5191
5197
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5192
- // validate the redirectUri (to be a non null value)
5193
- parameterBuilder.addRedirectUri(request.redirectUri);
5198
+ /*
5199
+ * For hybrid spa flow, there will be a code but no verifier
5200
+ * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI
5201
+ */
5202
+ if (!this.includeRedirectUri) {
5203
+ // Just validate
5204
+ RequestValidator.validateRedirectUri(request.redirectUri);
5205
+ }
5206
+ else {
5207
+ // Validate and include redirect uri
5208
+ parameterBuilder.addRedirectUri(request.redirectUri);
5209
+ }
5194
5210
  // Add scope array, parameter builder will add default scopes and dedupe
5195
5211
  parameterBuilder.addScopes(request.scopes);
5196
5212
  // add code: user set, not validated
@@ -5219,7 +5235,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5219
5235
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5220
5236
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5221
5237
  case 1:
5222
- cnfString = _a.sent();
5238
+ cnfString = _b.sent();
5223
5239
  parameterBuilder.addPopToken(cnfString);
5224
5240
  return [3 /*break*/, 3];
5225
5241
  case 2:
@@ -5231,7 +5247,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5231
5247
  throw ClientConfigurationError.createMissingSshJwkError();
5232
5248
  }
5233
5249
  }
5234
- _a.label = 3;
5250
+ _b.label = 3;
5235
5251
  case 3:
5236
5252
  correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5237
5253
  parameterBuilder.addCorrelationId(correlationId);
@@ -5271,6 +5287,15 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5271
5287
  break;
5272
5288
  }
5273
5289
  }
5290
+ if (request.tokenBodyParameters) {
5291
+ parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
5292
+ }
5293
+ // Add hybrid spa parameters if not already provided
5294
+ if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
5295
+ parameterBuilder.addExtraQueryParameters((_a = {},
5296
+ _a[AADServerParamKeys.RETURN_SPA_CODE] = "1",
5297
+ _a));
5298
+ }
5274
5299
  return [2 /*return*/, parameterBuilder.createQueryString()];
5275
5300
  }
5276
5301
  });
@@ -5408,7 +5433,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
5408
5433
  return AuthorizationCodeClient;
5409
5434
  }(BaseClient));
5410
5435
 
5411
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5436
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5412
5437
 
5413
5438
  /*
5414
5439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5619,7 +5644,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
5619
5644
  return RefreshTokenClient;
5620
5645
  }(BaseClient));
5621
5646
 
5622
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5647
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5623
5648
 
5624
5649
  /*
5625
5650
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5742,7 +5767,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
5742
5767
  return SilentFlowClient;
5743
5768
  }(BaseClient));
5744
5769
 
5745
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5770
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5746
5771
  /*
5747
5772
  * Copyright (c) Microsoft Corporation. All rights reserved.
5748
5773
  * Licensed under the MIT License.
@@ -5753,7 +5778,7 @@ function isOpenIdConfigResponse(response) {
5753
5778
  response.hasOwnProperty("issuer"));
5754
5779
  }
5755
5780
 
5756
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5781
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5757
5782
  /*
5758
5783
  * Copyright (c) Microsoft Corporation. All rights reserved.
5759
5784
  * Licensed under the MIT License.
@@ -5767,7 +5792,7 @@ exports.ProtocolMode = void 0;
5767
5792
  ProtocolMode["OIDC"] = "OIDC";
5768
5793
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
5769
5794
 
5770
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5795
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5771
5796
 
5772
5797
  /*
5773
5798
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5842,7 +5867,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
5842
5867
  return AuthorityMetadataEntity;
5843
5868
  }());
5844
5869
 
5845
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5870
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5846
5871
  /*
5847
5872
  * Copyright (c) Microsoft Corporation. All rights reserved.
5848
5873
  * Licensed under the MIT License.
@@ -5852,7 +5877,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5852
5877
  response.hasOwnProperty("metadata"));
5853
5878
  }
5854
5879
 
5855
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5880
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5856
5881
 
5857
5882
  /*
5858
5883
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5966,7 +5991,7 @@ var RegionDiscovery = /** @class */ (function () {
5966
5991
  return RegionDiscovery;
5967
5992
  }());
5968
5993
 
5969
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5994
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5970
5995
 
5971
5996
  /*
5972
5997
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6532,7 +6557,7 @@ var Authority = /** @class */ (function () {
6532
6557
  return Authority;
6533
6558
  }());
6534
6559
 
6535
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6560
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6536
6561
 
6537
6562
  /*
6538
6563
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6593,7 +6618,7 @@ var AuthorityFactory = /** @class */ (function () {
6593
6618
  return AuthorityFactory;
6594
6619
  }());
6595
6620
 
6596
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6621
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6597
6622
 
6598
6623
  /*
6599
6624
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6624,7 +6649,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
6624
6649
  return ServerTelemetryEntity;
6625
6650
  }());
6626
6651
 
6627
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6652
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6628
6653
 
6629
6654
  /*
6630
6655
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6652,7 +6677,7 @@ var ThrottlingEntity = /** @class */ (function () {
6652
6677
  return ThrottlingEntity;
6653
6678
  }());
6654
6679
 
6655
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6680
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6656
6681
 
6657
6682
  /*
6658
6683
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6669,7 +6694,7 @@ var StubbedNetworkModule = {
6669
6694
  }
6670
6695
  };
6671
6696
 
6672
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6697
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6673
6698
 
6674
6699
  /*
6675
6700
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6728,7 +6753,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
6728
6753
  return AuthenticationHeaderParser;
6729
6754
  }());
6730
6755
 
6731
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6756
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6732
6757
 
6733
6758
  /*
6734
6759
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6981,6 +7006,7 @@ exports.ApiId = void 0;
6981
7006
  ApiId[ApiId["ssoSilent"] = 863] = "ssoSilent";
6982
7007
  ApiId[ApiId["acquireTokenSilent_authCode"] = 864] = "acquireTokenSilent_authCode";
6983
7008
  ApiId[ApiId["handleRedirectPromise"] = 865] = "handleRedirectPromise";
7009
+ ApiId[ApiId["acquireTokenByCode"] = 866] = "acquireTokenByCode";
6984
7010
  ApiId[ApiId["acquireTokenSilent_silentFlow"] = 61] = "acquireTokenSilent_silentFlow";
6985
7011
  ApiId[ApiId["logout"] = 961] = "logout";
6986
7012
  ApiId[ApiId["logoutPopup"] = 962] = "logoutPopup";
@@ -7571,6 +7597,10 @@ var BrowserAuthErrorMessage = {
7571
7597
  code: "crypto_key_not_found",
7572
7598
  desc: "Cryptographic Key or Keypair not found in browser storage."
7573
7599
  },
7600
+ authCodeRequired: {
7601
+ code: "auth_code_required",
7602
+ desc: "An authorization code must be provided (as the `code` property on the request) to this flow."
7603
+ },
7574
7604
  databaseUnavailable: {
7575
7605
  code: "database_unavailable",
7576
7606
  desc: "IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."
@@ -7807,6 +7837,12 @@ var BrowserAuthError = /** @class */ (function (_super) {
7807
7837
  BrowserAuthError.createSigningKeyNotFoundInStorageError = function (keyId) {
7808
7838
  return new BrowserAuthError(BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code, BrowserAuthErrorMessage.signingKeyNotFoundInStorage.desc + " | No match found for KeyId: " + keyId);
7809
7839
  };
7840
+ /**
7841
+ * Create an error when an authorization code is required but not provided
7842
+ */
7843
+ BrowserAuthError.createAuthCodeRequiredError = function () {
7844
+ return new BrowserAuthError(BrowserAuthErrorMessage.authCodeRequired.code, BrowserAuthErrorMessage.authCodeRequired.desc);
7845
+ };
7810
7846
  /**
7811
7847
  * Create an error when IndexedDB is unavailable
7812
7848
  */
@@ -10295,7 +10331,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
10295
10331
 
10296
10332
  /* eslint-disable header/header */
10297
10333
  var name = "@azure/msal-browser";
10298
- var version = "2.19.0";
10334
+ var version = "2.20.0";
10299
10335
 
10300
10336
  /*
10301
10337
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10315,6 +10351,9 @@ exports.EventType = void 0;
10315
10351
  EventType["SSO_SILENT_START"] = "msal:ssoSilentStart";
10316
10352
  EventType["SSO_SILENT_SUCCESS"] = "msal:ssoSilentSuccess";
10317
10353
  EventType["SSO_SILENT_FAILURE"] = "msal:ssoSilentFailure";
10354
+ EventType["ACQUIRE_TOKEN_BY_CODE_START"] = "msal:acquireTokenByCodeStart";
10355
+ EventType["ACQUIRE_TOKEN_BY_CODE_SUCCESS"] = "msal:acquireTokenByCodeSuccess";
10356
+ EventType["ACQUIRE_TOKEN_BY_CODE_FAILURE"] = "msal:acquireTokenByCodeFailure";
10318
10357
  EventType["HANDLE_REDIRECT_START"] = "msal:handleRedirectStart";
10319
10358
  EventType["HANDLE_REDIRECT_END"] = "msal:handleRedirectEnd";
10320
10359
  EventType["POPUP_OPENED"] = "msal:popupOpened";
@@ -10996,23 +11035,46 @@ var InteractionHandler = /** @class */ (function () {
10996
11035
  * Function to handle response parameters from hash.
10997
11036
  * @param locationHash
10998
11037
  */
10999
- InteractionHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule) {
11038
+ InteractionHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule) {
11000
11039
  return __awaiter$1(this, void 0, void 0, function () {
11001
- var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11040
+ var stateKey, requestState, authCodeResponse;
11041
+ return __generator$1(this, function (_a) {
11042
+ this.browserRequestLogger.verbose("InteractionHandler.handleCodeResponse called");
11043
+ // Check that location hash isn't empty.
11044
+ if (StringUtils.isEmpty(locationHash)) {
11045
+ throw BrowserAuthError.createEmptyHashError(locationHash);
11046
+ }
11047
+ stateKey = this.browserStorage.generateStateKey(state);
11048
+ requestState = this.browserStorage.getTemporaryCache(stateKey);
11049
+ if (!requestState) {
11050
+ throw ClientAuthError.createStateNotFoundError("Cached State");
11051
+ }
11052
+ authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);
11053
+ return [2 /*return*/, this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule)];
11054
+ });
11055
+ });
11056
+ };
11057
+ /**
11058
+ * Process auth code response from AAD
11059
+ * @param authCodeResponse
11060
+ * @param state
11061
+ * @param authority
11062
+ * @param networkModule
11063
+ * @returns
11064
+ */
11065
+ InteractionHandler.prototype.handleCodeResponseFromServer = function (authCodeResponse, state, authority, networkModule, validateNonce) {
11066
+ if (validateNonce === void 0) { validateNonce = true; }
11067
+ return __awaiter$1(this, void 0, void 0, function () {
11068
+ var stateKey, requestState, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11002
11069
  return __generator$1(this, function (_a) {
11003
11070
  switch (_a.label) {
11004
11071
  case 0:
11005
- this.browserRequestLogger.verbose("InteractionHandler.handleCodeResponse called");
11006
- // Check that location hash isn't empty.
11007
- if (StringUtils.isEmpty(locationHash)) {
11008
- throw BrowserAuthError.createEmptyHashError(locationHash);
11009
- }
11072
+ this.browserRequestLogger.trace("InteractionHandler.handleCodeResponseFromServer called");
11010
11073
  stateKey = this.browserStorage.generateStateKey(state);
11011
11074
  requestState = this.browserStorage.getTemporaryCache(stateKey);
11012
11075
  if (!requestState) {
11013
11076
  throw ClientAuthError.createStateNotFoundError("Cached State");
11014
11077
  }
11015
- authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);
11016
11078
  nonceKey = this.browserStorage.generateNonceKey(requestState);
11017
11079
  cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);
11018
11080
  // Assign code to request
@@ -11023,7 +11085,10 @@ var InteractionHandler = /** @class */ (function () {
11023
11085
  _a.sent();
11024
11086
  _a.label = 2;
11025
11087
  case 2:
11026
- authCodeResponse.nonce = cachedNonce || undefined;
11088
+ // Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)
11089
+ if (validateNonce) {
11090
+ authCodeResponse.nonce = cachedNonce || undefined;
11091
+ }
11027
11092
  authCodeResponse.state = requestState;
11028
11093
  // Add CCS parameters if available
11029
11094
  if (authCodeResponse.client_info) {
@@ -11255,7 +11320,7 @@ var PopupClient = /** @class */ (function (_super) {
11255
11320
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
11256
11321
  // Remove throttle if it exists
11257
11322
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
11258
- return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];
11323
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
11259
11324
  case 6:
11260
11325
  result = _a.sent();
11261
11326
  return [2 /*return*/, result];
@@ -11439,7 +11504,7 @@ var RedirectHandler = /** @class */ (function (_super) {
11439
11504
  * Handle authorization code response in the window.
11440
11505
  * @param hash
11441
11506
  */
11442
- RedirectHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule, clientId) {
11507
+ RedirectHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule, clientId) {
11443
11508
  return __awaiter$1(this, void 0, void 0, function () {
11444
11509
  var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11445
11510
  return __generator$1(this, function (_a) {
@@ -11700,7 +11765,7 @@ var RedirectClient = /** @class */ (function (_super) {
11700
11765
  authClient = _a.sent();
11701
11766
  this.logger.verbose("Auth code client created");
11702
11767
  interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto);
11703
- return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient, this.config.auth.clientId)];
11768
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient, this.config.auth.clientId)];
11704
11769
  case 2: return [2 /*return*/, _a.sent()];
11705
11770
  }
11706
11771
  });
@@ -12024,7 +12089,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
12024
12089
  hash = _a.sent();
12025
12090
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Silent, authCodeRequest.correlationId);
12026
12091
  // Handle response from hash string
12027
- return [2 /*return*/, silentHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];
12092
+ return [2 /*return*/, silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
12028
12093
  }
12029
12094
  });
12030
12095
  });
@@ -12215,6 +12280,88 @@ var TokenCache = /** @class */ (function () {
12215
12280
  return TokenCache;
12216
12281
  }());
12217
12282
 
12283
+ /*
12284
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12285
+ * Licensed under the MIT License.
12286
+ */
12287
+ var HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {
12288
+ __extends$1(HybridSpaAuthorizationCodeClient, _super);
12289
+ function HybridSpaAuthorizationCodeClient(config) {
12290
+ var _this = _super.call(this, config) || this;
12291
+ _this.includeRedirectUri = false;
12292
+ return _this;
12293
+ }
12294
+ return HybridSpaAuthorizationCodeClient;
12295
+ }(AuthorizationCodeClient));
12296
+
12297
+ /*
12298
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12299
+ * Licensed under the MIT License.
12300
+ */
12301
+ var SilentAuthCodeClient = /** @class */ (function (_super) {
12302
+ __extends$1(SilentAuthCodeClient, _super);
12303
+ function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
12304
+ var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
12305
+ _this.apiId = apiId;
12306
+ return _this;
12307
+ }
12308
+ /**
12309
+ * Acquires a token silently by redeeming an authorization code against the /token endpoint
12310
+ * @param request
12311
+ */
12312
+ SilentAuthCodeClient.prototype.acquireToken = function (request) {
12313
+ return __awaiter$1(this, void 0, void 0, function () {
12314
+ var silentRequest, serverTelemetryManager, authCodeRequest, clientConfig, authClient, silentHandler, e_1;
12315
+ return __generator$1(this, function (_a) {
12316
+ switch (_a.label) {
12317
+ case 0:
12318
+ this.logger.trace("SilentAuthCodeClient.acquireToken called");
12319
+ // Auth code payload is required
12320
+ if (!request.code) {
12321
+ throw BrowserAuthError.createAuthCodeRequiredError();
12322
+ }
12323
+ silentRequest = this.initializeAuthorizationRequest(request, exports.InteractionType.Silent);
12324
+ serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12325
+ _a.label = 1;
12326
+ case 1:
12327
+ _a.trys.push([1, 3, , 4]);
12328
+ authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
12329
+ return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
12330
+ case 2:
12331
+ clientConfig = _a.sent();
12332
+ authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
12333
+ this.logger.verbose("Auth code client created");
12334
+ silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system.navigateFrameWait);
12335
+ // Handle auth code parameters from request
12336
+ return [2 /*return*/, silentHandler.handleCodeResponseFromServer({
12337
+ code: request.code,
12338
+ msgraph_host: request.msGraphHost,
12339
+ cloud_graph_host_name: request.cloudGraphHostName,
12340
+ cloud_instance_host_name: request.cloudInstanceHostName
12341
+ }, silentRequest.state, authClient.authority, this.networkClient, false)];
12342
+ case 3:
12343
+ e_1 = _a.sent();
12344
+ if (e_1 instanceof AuthError) {
12345
+ e_1.setCorrelationId(this.correlationId);
12346
+ }
12347
+ serverTelemetryManager.cacheFailedRequest(e_1);
12348
+ this.browserStorage.cleanRequestByState(silentRequest.state);
12349
+ throw e_1;
12350
+ case 4: return [2 /*return*/];
12351
+ }
12352
+ });
12353
+ });
12354
+ };
12355
+ /**
12356
+ * Currently Unsupported
12357
+ */
12358
+ SilentAuthCodeClient.prototype.logout = function () {
12359
+ // Synchronous so we must reject
12360
+ return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
12361
+ };
12362
+ return SilentAuthCodeClient;
12363
+ }(StandardInteractionClient));
12364
+
12218
12365
  /*
12219
12366
  * Copyright (c) Microsoft Corporation. All rights reserved.
12220
12367
  * Licensed under the MIT License.
@@ -12258,6 +12405,8 @@ var ClientApplication = /** @class */ (function () {
12258
12405
  this.navigationClient = this.config.system.navigationClient;
12259
12406
  // Initialize redirectResponse Map
12260
12407
  this.redirectResponse = new Map();
12408
+ // Initial hybrid spa map
12409
+ this.hybridAuthCodeResponses = new Map();
12261
12410
  // Initialize the crypto class.
12262
12411
  this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger) : DEFAULT_CRYPTO_IMPLEMENTATION;
12263
12412
  this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
@@ -12462,6 +12611,77 @@ var ClientApplication = /** @class */ (function () {
12462
12611
  });
12463
12612
  });
12464
12613
  };
12614
+ /**
12615
+ * This function redeems an authorization code (passed as code) from the eSTS token endpoint.
12616
+ * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
12617
+ * This API is not indended for normal authorization code acquisition and redemption.
12618
+ *
12619
+ * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
12620
+ *
12621
+ * @param request {@link AuthorizationCodeRequest}
12622
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
12623
+ */
12624
+ ClientApplication.prototype.acquireTokenByCode = function (request) {
12625
+ return __awaiter$1(this, void 0, void 0, function () {
12626
+ var response;
12627
+ var _this = this;
12628
+ return __generator$1(this, function (_a) {
12629
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
12630
+ this.logger.trace("acquireTokenByCode called", request.correlationId);
12631
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
12632
+ try {
12633
+ if (!request.code) {
12634
+ throw BrowserAuthError.createAuthCodeRequiredError();
12635
+ }
12636
+ response = this.hybridAuthCodeResponses.get(request.code);
12637
+ if (!response) {
12638
+ this.logger.verbose("Initiating new acquireTokenByCode request", request.correlationId);
12639
+ response = this.acquireTokenByCodeAsync(request)
12640
+ .then(function (result) {
12641
+ _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
12642
+ _this.hybridAuthCodeResponses.delete(request.code);
12643
+ return result;
12644
+ })
12645
+ .catch(function (error) {
12646
+ _this.hybridAuthCodeResponses.delete(request.code);
12647
+ throw error;
12648
+ });
12649
+ this.hybridAuthCodeResponses.set(request.code, response);
12650
+ }
12651
+ else {
12652
+ this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
12653
+ }
12654
+ return [2 /*return*/, response];
12655
+ }
12656
+ catch (e) {
12657
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
12658
+ throw e;
12659
+ }
12660
+ return [2 /*return*/];
12661
+ });
12662
+ });
12663
+ };
12664
+ /**
12665
+ * Creates a SilentAuthCodeClient to redeem an authorization code.
12666
+ * @param request
12667
+ * @returns Result of the operation to redeem the authorization code
12668
+ */
12669
+ ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {
12670
+ return __awaiter$1(this, void 0, void 0, function () {
12671
+ var silentAuthCodeClient, silentTokenResult;
12672
+ return __generator$1(this, function (_a) {
12673
+ switch (_a.label) {
12674
+ case 0:
12675
+ this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
12676
+ silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenByCode, request.correlationId);
12677
+ return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
12678
+ case 1:
12679
+ silentTokenResult = _a.sent();
12680
+ return [2 /*return*/, silentTokenResult];
12681
+ }
12682
+ });
12683
+ });
12684
+ };
12465
12685
  /**
12466
12686
  * Use this function to obtain a token before every call to the API / resource provider
12467
12687
  *
@@ -12960,6 +13180,9 @@ var stubbedPublicClientApplication = {
12960
13180
  acquireTokenSilent: function () {
12961
13181
  return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
12962
13182
  },
13183
+ acquireTokenByCode: function () {
13184
+ return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
13185
+ },
12963
13186
  getAllAccounts: function () {
12964
13187
  return [];
12965
13188
  },