@azure/msal-browser 3.3.0 → 3.5.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 (150) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/PublicClientApplication.mjs +3 -4
  4. package/dist/app/PublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientNext.d.ts.map +1 -1
  6. package/dist/app/PublicClientNext.mjs +4 -6
  7. package/dist/app/PublicClientNext.mjs.map +1 -1
  8. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  9. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  10. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  11. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  12. package/dist/cache/BrowserCacheManager.mjs +26 -26
  13. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  14. package/dist/cache/BrowserStorage.mjs +1 -1
  15. package/dist/cache/CryptoKeyStore.mjs +1 -1
  16. package/dist/cache/DatabaseStorage.mjs +1 -1
  17. package/dist/cache/MemoryStorage.mjs +1 -1
  18. package/dist/cache/TokenCache.d.ts.map +1 -1
  19. package/dist/cache/TokenCache.mjs +5 -5
  20. package/dist/cache/TokenCache.mjs.map +1 -1
  21. package/dist/config/Configuration.mjs +1 -1
  22. package/dist/controllers/ControllerFactory.d.ts +2 -8
  23. package/dist/controllers/ControllerFactory.d.ts.map +1 -1
  24. package/dist/controllers/ControllerFactory.mjs +21 -38
  25. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  26. package/dist/controllers/IController.d.ts +1 -2
  27. package/dist/controllers/IController.d.ts.map +1 -1
  28. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  29. package/dist/controllers/StandardController.d.ts +4 -4
  30. package/dist/controllers/StandardController.d.ts.map +1 -1
  31. package/dist/controllers/StandardController.mjs +50 -51
  32. package/dist/controllers/StandardController.mjs.map +1 -1
  33. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  34. package/dist/crypto/BrowserCrypto.mjs +1 -1
  35. package/dist/crypto/CryptoOps.d.ts +2 -2
  36. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  37. package/dist/crypto/CryptoOps.mjs +4 -3
  38. package/dist/crypto/CryptoOps.mjs.map +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 +1 -1
  50. package/dist/event/EventHandler.mjs +1 -1
  51. package/dist/event/EventMessage.mjs +1 -1
  52. package/dist/event/EventType.mjs +1 -1
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.mjs +2 -2
  56. package/dist/interaction_client/BaseInteractionClient.d.ts +0 -1
  57. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  58. package/dist/interaction_client/BaseInteractionClient.mjs +2 -3
  59. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  60. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  61. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  62. package/dist/interaction_client/NativeInteractionClient.mjs +4 -4
  63. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  64. package/dist/interaction_client/PopupClient.d.ts +1 -12
  65. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  66. package/dist/interaction_client/PopupClient.mjs +28 -111
  67. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  68. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  69. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  70. package/dist/interaction_client/RedirectClient.mjs +59 -50
  71. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  72. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  73. package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -5
  74. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  75. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  76. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  77. package/dist/interaction_client/SilentIframeClient.mjs +9 -23
  78. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  79. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  80. package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
  81. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  82. package/dist/interaction_client/StandardInteractionClient.d.ts +1 -6
  83. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  84. package/dist/interaction_client/StandardInteractionClient.mjs +2 -24
  85. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  86. package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
  87. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  88. package/dist/interaction_handler/InteractionHandler.mjs +30 -61
  89. package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
  90. package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
  91. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  92. package/dist/interaction_handler/RedirectHandler.mjs +30 -15
  93. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  94. package/dist/interaction_handler/SilentHandler.d.ts +2 -2
  95. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  96. package/dist/interaction_handler/SilentHandler.mjs +13 -7
  97. package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
  98. package/dist/naa/BridgeError.mjs +1 -1
  99. package/dist/naa/BridgeProxy.mjs +1 -1
  100. package/dist/naa/BridgeStatusCode.mjs +1 -1
  101. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  102. package/dist/navigation/NavigationClient.mjs +1 -1
  103. package/dist/network/FetchClient.mjs +1 -1
  104. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  105. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  106. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
  107. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  108. package/dist/packageMetadata.d.ts +1 -1
  109. package/dist/packageMetadata.mjs +2 -2
  110. package/dist/response/ResponseHandler.d.ts +8 -0
  111. package/dist/response/ResponseHandler.d.ts.map +1 -0
  112. package/dist/response/ResponseHandler.mjs +46 -0
  113. package/dist/response/ResponseHandler.mjs.map +1 -0
  114. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  115. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  116. package/dist/utils/BrowserConstants.mjs +1 -1
  117. package/dist/utils/BrowserProtocolUtils.d.ts +7 -14
  118. package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
  119. package/dist/utils/BrowserProtocolUtils.mjs +17 -30
  120. package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
  121. package/dist/utils/BrowserUtils.mjs +1 -1
  122. package/lib/msal-browser.cjs +18434 -61
  123. package/lib/msal-browser.cjs.map +1 -1
  124. package/lib/msal-browser.js +3037 -3733
  125. package/lib/msal-browser.js.map +1 -1
  126. package/lib/msal-browser.min.js +68 -66
  127. package/package.json +2 -2
  128. package/src/app/PublicClientApplication.ts +4 -3
  129. package/src/app/PublicClientNext.ts +7 -5
  130. package/src/cache/BrowserCacheManager.ts +29 -50
  131. package/src/cache/TokenCache.ts +5 -4
  132. package/src/controllers/ControllerFactory.ts +30 -49
  133. package/src/controllers/IController.ts +0 -6
  134. package/src/controllers/StandardController.ts +70 -85
  135. package/src/crypto/CryptoOps.ts +5 -3
  136. package/src/index.ts +1 -0
  137. package/src/interaction_client/BaseInteractionClient.ts +1 -2
  138. package/src/interaction_client/NativeInteractionClient.ts +4 -3
  139. package/src/interaction_client/PopupClient.ts +72 -196
  140. package/src/interaction_client/RedirectClient.ts +111 -100
  141. package/src/interaction_client/SilentAuthCodeClient.ts +1 -12
  142. package/src/interaction_client/SilentIframeClient.ts +17 -44
  143. package/src/interaction_client/SilentRefreshClient.ts +5 -19
  144. package/src/interaction_client/StandardInteractionClient.ts +2 -48
  145. package/src/interaction_handler/InteractionHandler.ts +39 -112
  146. package/src/interaction_handler/RedirectHandler.ts +52 -30
  147. package/src/interaction_handler/SilentHandler.ts +12 -5
  148. package/src/packageMetadata.ts +1 -1
  149. package/src/response/ResponseHandler.ts +73 -0
  150. package/src/utils/BrowserProtocolUtils.ts +17 -36
@@ -11,15 +11,15 @@ import {
11
11
  UrlString,
12
12
  AuthError,
13
13
  OIDC_DEFAULT_SCOPES,
14
- Constants,
15
14
  ProtocolUtils,
16
- ServerAuthorizationCodeResponse,
17
15
  PerformanceEvents,
18
16
  IPerformanceClient,
19
17
  Logger,
20
18
  ICrypto,
21
19
  ProtocolMode,
22
20
  ServerResponseType,
21
+ invokeAsync,
22
+ invoke,
23
23
  } from "@azure/msal-common";
24
24
  import { StandardInteractionClient } from "./StandardInteractionClient";
25
25
  import { EventType } from "../event/EventType";
@@ -42,15 +42,13 @@ import { INavigationClient } from "../navigation/INavigationClient";
42
42
  import { EventHandler } from "../event/EventHandler";
43
43
  import { BrowserCacheManager } from "../cache/BrowserCacheManager";
44
44
  import { BrowserConfiguration } from "../config/Configuration";
45
- import {
46
- InteractionHandler,
47
- InteractionParams,
48
- } from "../interaction_handler/InteractionHandler";
45
+ import { InteractionHandler } from "../interaction_handler/InteractionHandler";
49
46
  import { PopupWindowAttributes } from "../request/PopupWindowAttributes";
50
47
  import { EventError } from "../event/EventMessage";
51
48
  import { AuthenticationResult } from "../response/AuthenticationResult";
49
+ import * as ResponseHandler from "../response/ResponseHandler";
52
50
 
53
- export type PopupParams = InteractionParams & {
51
+ export type PopupParams = {
54
52
  popup?: Window | null;
55
53
  popupName: string;
56
54
  popupWindowAttributes: PopupWindowAttributes;
@@ -203,44 +201,39 @@ export class PopupClient extends StandardInteractionClient {
203
201
  ApiId.acquireTokenPopup
204
202
  );
205
203
 
206
- this.performanceClient.setPreQueueTime(
204
+ const validRequest = await invokeAsync(
205
+ this.initializeAuthorizationRequest.bind(this),
207
206
  PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
208
- request.correlationId
209
- );
210
- const validRequest = await this.initializeAuthorizationRequest(
211
- request,
212
- InteractionType.Popup
213
- );
207
+ this.logger,
208
+ this.performanceClient,
209
+ this.correlationId
210
+ )(request, InteractionType.Popup);
211
+
214
212
  BrowserUtils.preconnect(validRequest.authority);
215
- this.browserStorage.updateCacheEntries(
216
- validRequest.state,
217
- validRequest.nonce,
218
- validRequest.authority,
219
- validRequest.loginHint || Constants.EMPTY_STRING,
220
- validRequest.account || null
221
- );
222
213
 
223
214
  try {
224
215
  // Create auth code request and generate PKCE params
225
- this.performanceClient.setPreQueueTime(
226
- PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
227
- request.correlationId
228
- );
229
216
  const authCodeRequest: CommonAuthorizationCodeRequest =
230
- await this.initializeAuthorizationCodeRequest(validRequest);
217
+ await invokeAsync(
218
+ this.initializeAuthorizationCodeRequest.bind(this),
219
+ PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
220
+ this.logger,
221
+ this.performanceClient,
222
+ this.correlationId
223
+ )(validRequest);
231
224
 
232
225
  // Initialize the client
233
- this.performanceClient.setPreQueueTime(
226
+ const authClient: AuthorizationCodeClient = await invokeAsync(
227
+ this.createAuthCodeClient.bind(this),
234
228
  PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
235
- request.correlationId
229
+ this.logger,
230
+ this.performanceClient,
231
+ this.correlationId
232
+ )(
233
+ serverTelemetryManager,
234
+ validRequest.authority,
235
+ validRequest.azureCloudOptions
236
236
  );
237
- const authClient: AuthorizationCodeClient =
238
- await this.createAuthCodeClient(
239
- serverTelemetryManager,
240
- validRequest.authority,
241
- validRequest.azureCloudOptions
242
- );
243
- this.logger.verbose("Auth code client created");
244
237
 
245
238
  const isNativeBroker = NativeMessageHandler.isNativeAvailable(
246
239
  this.config,
@@ -291,14 +284,18 @@ export class PopupClient extends StandardInteractionClient {
291
284
  );
292
285
 
293
286
  // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
294
- const hash = await this.monitorPopupForHash(popupWindow);
295
- // Deserialize hash fragment response parameters.
296
- const serverParams: ServerAuthorizationCodeResponse =
297
- UrlString.getDeserializedHash(hash);
298
- const state = this.validateAndExtractStateFromHash(
299
- serverParams,
300
- InteractionType.Popup,
301
- validRequest.correlationId
287
+ const responseString = await this.monitorPopupForHash(popupWindow);
288
+
289
+ const serverParams = invoke(
290
+ ResponseHandler.deserializeResponse,
291
+ PerformanceEvents.DeserializeResponse,
292
+ this.logger,
293
+ this.performanceClient,
294
+ this.correlationId
295
+ )(
296
+ responseString,
297
+ this.config.auth.OIDCOptions.serverResponseType,
298
+ this.logger
302
299
  );
303
300
  // Remove throttle if it exists
304
301
  ThrottlingUtils.removeThrottle(
@@ -340,25 +337,19 @@ export class PopupClient extends StandardInteractionClient {
340
337
  );
341
338
  const { userRequestState } = ProtocolUtils.parseRequestState(
342
339
  this.browserCrypto,
343
- state
340
+ validRequest.state
344
341
  );
345
- return nativeInteractionClient
346
- .acquireToken({
347
- ...validRequest,
348
- state: userRequestState,
349
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
350
- })
351
- .finally(() => {
352
- this.browserStorage.cleanRequestByState(state);
353
- });
342
+ return nativeInteractionClient.acquireToken({
343
+ ...validRequest,
344
+ state: userRequestState,
345
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
346
+ });
354
347
  }
355
348
 
356
349
  // Handle response from hash string.
357
- const result = await interactionHandler.handleCodeResponseFromHash(
358
- hash,
359
- state,
360
- authClient.authority,
361
- this.networkClient
350
+ const result = await interactionHandler.handleCodeResponse(
351
+ serverParams,
352
+ validRequest
362
353
  );
363
354
 
364
355
  return result;
@@ -372,7 +363,6 @@ export class PopupClient extends StandardInteractionClient {
372
363
  (e as AuthError).setCorrelationId(this.correlationId);
373
364
  serverTelemetryManager.cacheFailedRequest(e);
374
365
  }
375
- this.browserStorage.cleanRequestByState(validRequest.state);
376
366
  throw e;
377
367
  }
378
368
  }
@@ -410,15 +400,13 @@ export class PopupClient extends StandardInteractionClient {
410
400
  await this.clearCacheOnLogout(validRequest.account);
411
401
 
412
402
  // Initialize the client
413
- this.performanceClient.setPreQueueTime(
403
+ const authClient = await invokeAsync(
404
+ this.createAuthCodeClient.bind(this),
414
405
  PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
415
- validRequest.correlationId
416
- );
417
- const authClient = await this.createAuthCodeClient(
418
- serverTelemetryManager,
419
- requestAuthority
420
- );
421
- this.logger.verbose("Auth code client created");
406
+ this.logger,
407
+ this.performanceClient,
408
+ this.correlationId
409
+ )(serverTelemetryManager, requestAuthority);
422
410
 
423
411
  try {
424
412
  authClient.authority.endSessionEndpoint;
@@ -485,7 +473,9 @@ export class PopupClient extends StandardInteractionClient {
485
473
  null
486
474
  );
487
475
 
488
- await this.waitForLogoutPopup(popupWindow);
476
+ await this.monitorPopupForHash(popupWindow).catch(() => {
477
+ // Swallow any errors related to monitoring the window. Server logout is best effort
478
+ });
489
479
 
490
480
  if (mainWindowRedirectUri) {
491
481
  const navigationOptions: NavigationOptions = {
@@ -566,16 +556,7 @@ export class PopupClient extends StandardInteractionClient {
566
556
  * @param timeout - timeout for processing hash once popup is redirected back to application
567
557
  */
568
558
  monitorPopupForHash(popupWindow: Window): Promise<string> {
569
- return new Promise((resolve, reject) => {
570
- /*
571
- * Polling for popups needs to be tick-based,
572
- * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
573
- */
574
- const maxTicks =
575
- this.config.system.windowHashTimeout /
576
- this.config.system.pollIntervalMilliseconds;
577
- let ticks = 0;
578
-
559
+ return new Promise<string>((resolve, reject) => {
579
560
  this.logger.verbose(
580
561
  "PopupHandler.monitorPopupForHash - polling started"
581
562
  );
@@ -586,7 +567,6 @@ export class PopupClient extends StandardInteractionClient {
586
567
  this.logger.error(
587
568
  "PopupHandler.monitorPopupForHash - window closed"
588
569
  );
589
- this.cleanPopup();
590
570
  clearInterval(intervalId);
591
571
  reject(
592
572
  createBrowserAuthError(
@@ -596,8 +576,7 @@ export class PopupClient extends StandardInteractionClient {
596
576
  return;
597
577
  }
598
578
 
599
- let href = Constants.EMPTY_STRING;
600
- let serverResponseString = Constants.EMPTY_STRING;
579
+ let href = "";
601
580
  try {
602
581
  /*
603
582
  * Will throw if cross origin,
@@ -605,117 +584,33 @@ export class PopupClient extends StandardInteractionClient {
605
584
  * since we need the interval to keep running while on STS UI.
606
585
  */
607
586
  href = popupWindow.location.href;
608
- serverResponseString =
609
- this.extractServerResponseStringFromPopup(
610
- popupWindow,
611
- href
612
- );
613
587
  } catch (e) {}
614
588
 
615
589
  // Don't process blank pages or cross domain
616
590
  if (!href || href === "about:blank") {
617
591
  return;
618
592
  }
593
+ clearInterval(intervalId);
619
594
 
620
- this.logger.verbose(
621
- "PopupHandler.monitorPopupForHash - popup window is on same origin as caller"
622
- );
623
-
624
- /*
625
- * Only run clock when we are on same domain for popups
626
- * as popup operations can take a long time.
627
- */
628
- ticks++;
629
-
630
- if (serverResponseString) {
631
- this.logger.verbose(
632
- "PopupHandler.monitorPopupForHash - found hash in url"
633
- );
634
- clearInterval(intervalId);
635
- this.cleanPopup(popupWindow);
636
-
637
- if (
638
- UrlString.hashContainsKnownProperties(
639
- serverResponseString
640
- )
641
- ) {
642
- this.logger.verbose(
643
- "PopupHandler.monitorPopupForHash - hash contains known properties, returning."
644
- );
645
- resolve(serverResponseString);
595
+ let responseString = "";
596
+ const responseType =
597
+ this.config.auth.OIDCOptions.serverResponseType;
598
+ if (popupWindow) {
599
+ if (responseType === ServerResponseType.QUERY) {
600
+ responseString = popupWindow.location.search;
646
601
  } else {
647
- this.logger.error(
648
- "PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely."
649
- );
650
- this.logger.errorPii(
651
- `PopupHandler.monitorPopupForHash - hash found: ${serverResponseString}`
652
- );
653
- reject(
654
- createBrowserAuthError(
655
- BrowserAuthErrorCodes.hashDoesNotContainKnownProperties
656
- )
657
- );
602
+ responseString = popupWindow.location.hash;
658
603
  }
659
- } else if (ticks > maxTicks) {
660
- this.logger.error(
661
- "PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"
662
- );
663
- clearInterval(intervalId);
664
- reject(
665
- createBrowserAuthError(
666
- BrowserAuthErrorCodes.monitorPopupTimeout
667
- )
668
- );
669
- }
670
- }, this.config.system.pollIntervalMilliseconds);
671
- });
672
- }
673
-
674
- /**
675
- * Waits for user interaction in logout popup window
676
- * @param popupWindow
677
- * @returns
678
- */
679
- waitForLogoutPopup(popupWindow: Window): Promise<void> {
680
- return new Promise((resolve) => {
681
- this.logger.verbose(
682
- "PopupHandler.waitForLogoutPopup - polling started"
683
- );
684
-
685
- const intervalId = setInterval(() => {
686
- // Window is closed
687
- if (popupWindow.closed) {
688
- this.logger.error(
689
- "PopupHandler.waitForLogoutPopup - window closed"
690
- );
691
- this.cleanPopup();
692
- clearInterval(intervalId);
693
- resolve();
694
- }
695
-
696
- let href: string = Constants.EMPTY_STRING;
697
- try {
698
- /*
699
- * Will throw if cross origin,
700
- * which should be caught and ignored
701
- * since we need the interval to keep running while on STS UI.
702
- */
703
- href = popupWindow.location.href;
704
- } catch (e) {}
705
-
706
- // Don't process blank pages or cross domain
707
- if (!href || href === "about:blank") {
708
- return;
709
604
  }
710
605
 
711
606
  this.logger.verbose(
712
- "PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."
607
+ "PopupHandler.monitorPopupForHash - popup window is on same origin as caller"
713
608
  );
714
609
 
715
- clearInterval(intervalId);
716
- this.cleanPopup(popupWindow);
717
- resolve();
610
+ resolve(responseString);
718
611
  }, this.config.system.pollIntervalMilliseconds);
612
+ }).finally(() => {
613
+ this.cleanPopup(popupWindow);
719
614
  });
720
615
  }
721
616
 
@@ -905,23 +800,4 @@ export class PopupClient extends StandardInteractionClient {
905
800
  const homeAccountId = request.account && request.account.homeAccountId;
906
801
  return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
907
802
  }
908
-
909
- /**
910
- * Extracts the server response from the popup window
911
- */
912
- extractServerResponseStringFromPopup(
913
- popupWindow: Window,
914
- href: string
915
- ): string {
916
- let serverResponseString;
917
- if (
918
- this.config.auth.OIDCOptions?.serverResponseType ===
919
- ServerResponseType.QUERY
920
- ) {
921
- serverResponseString = UrlString.parseQueryServerResponse(href);
922
- } else {
923
- serverResponseString = popupWindow.location.hash;
924
- }
925
- return serverResponseString;
926
- }
927
803
  }