@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
@@ -21,15 +21,13 @@ import {
21
21
  PromptValue,
22
22
  InProgressPerformanceEvent,
23
23
  RequestThumbprint,
24
- ServerError,
25
24
  AccountEntity,
26
- ServerResponseType,
27
- UrlString,
28
25
  invokeAsync,
29
26
  createClientAuthError,
30
27
  ClientAuthErrorCodes,
31
28
  AccountFilter,
32
29
  buildStaticAuthorityOptions,
30
+ InteractionRequiredAuthErrorCodes,
33
31
  } from "@azure/msal-common";
34
32
  import {
35
33
  BrowserCacheManager,
@@ -336,16 +334,6 @@ export class StandardController implements IController {
336
334
  // Block token acquisition before initialize has been called
337
335
  BrowserUtils.blockAPICallsBeforeInitialize(this.initialized);
338
336
 
339
- let foundServerResponse = hash;
340
-
341
- if (
342
- this.config.auth.OIDCOptions?.serverResponseType ===
343
- ServerResponseType.QUERY
344
- ) {
345
- const url = window.location.href;
346
- foundServerResponse = UrlString.parseQueryServerResponse(url);
347
- }
348
-
349
337
  const loggedInAccounts = this.getAllAccounts();
350
338
  if (this.isBrowserEnvironment) {
351
339
  /**
@@ -353,8 +341,7 @@ export class StandardController implements IController {
353
341
  * otherwise return the promise from the first invocation. Prevents race conditions when handleRedirectPromise is called
354
342
  * several times concurrently.
355
343
  */
356
- const redirectResponseKey =
357
- foundServerResponse || Constants.EMPTY_STRING;
344
+ const redirectResponseKey = hash || "";
358
345
  let response = this.redirectResponse.get(redirectResponseKey);
359
346
  if (typeof response === "undefined") {
360
347
  this.eventHandler.emitEvent(
@@ -376,7 +363,7 @@ export class StandardController implements IController {
376
363
  this.nativeExtensionProvider
377
364
  ) &&
378
365
  this.nativeExtensionProvider &&
379
- !foundServerResponse
366
+ !hash
380
367
  ) {
381
368
  this.logger.trace(
382
369
  "handleRedirectPromise - acquiring token from native platform"
@@ -408,9 +395,7 @@ export class StandardController implements IController {
408
395
  const redirectClient =
409
396
  this.createRedirectClient(correlationId);
410
397
  redirectResponse =
411
- redirectClient.handleRedirectPromise(
412
- foundServerResponse
413
- );
398
+ redirectClient.handleRedirectPromise(hash);
414
399
  }
415
400
 
416
401
  response = redirectResponse
@@ -533,7 +518,7 @@ export class StandardController implements IController {
533
518
  this.nativeExtensionProvider,
534
519
  this.getNativeAccountId(request),
535
520
  this.nativeInternalStorage,
536
- request.correlationId
521
+ correlationId
537
522
  );
538
523
  result = nativeClient
539
524
  .acquireTokenRedirect(request)
@@ -543,26 +528,22 @@ export class StandardController implements IController {
543
528
  isFatalNativeAuthError(e)
544
529
  ) {
545
530
  this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
546
- const redirectClient = this.createRedirectClient(
547
- request.correlationId
548
- );
531
+ const redirectClient =
532
+ this.createRedirectClient(correlationId);
549
533
  return redirectClient.acquireToken(request);
550
534
  } else if (e instanceof InteractionRequiredAuthError) {
551
535
  this.logger.verbose(
552
536
  "acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"
553
537
  );
554
- const redirectClient = this.createRedirectClient(
555
- request.correlationId
556
- );
538
+ const redirectClient =
539
+ this.createRedirectClient(correlationId);
557
540
  return redirectClient.acquireToken(request);
558
541
  }
559
542
  this.getBrowserStorage().setInteractionInProgress(false);
560
543
  throw e;
561
544
  });
562
545
  } else {
563
- const redirectClient = this.createRedirectClient(
564
- request.correlationId
565
- );
546
+ const redirectClient = this.createRedirectClient(correlationId);
566
547
  result = redirectClient.acquireToken(request);
567
548
  }
568
549
 
@@ -632,7 +613,13 @@ export class StandardController implements IController {
632
613
  let result: Promise<AuthenticationResult>;
633
614
 
634
615
  if (this.canUseNative(request)) {
635
- result = this.acquireTokenNative(request, ApiId.acquireTokenPopup)
616
+ result = this.acquireTokenNative(
617
+ {
618
+ ...request,
619
+ correlationId,
620
+ },
621
+ ApiId.acquireTokenPopup
622
+ )
636
623
  .then((response) => {
637
624
  this.getBrowserStorage().setInteractionInProgress(false);
638
625
  atPopupMeasurement.end({
@@ -648,24 +635,22 @@ export class StandardController implements IController {
648
635
  isFatalNativeAuthError(e)
649
636
  ) {
650
637
  this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
651
- const popupClient = this.createPopupClient(
652
- request.correlationId
653
- );
638
+ const popupClient =
639
+ this.createPopupClient(correlationId);
654
640
  return popupClient.acquireToken(request);
655
641
  } else if (e instanceof InteractionRequiredAuthError) {
656
642
  this.logger.verbose(
657
643
  "acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"
658
644
  );
659
- const popupClient = this.createPopupClient(
660
- request.correlationId
661
- );
645
+ const popupClient =
646
+ this.createPopupClient(correlationId);
662
647
  return popupClient.acquireToken(request);
663
648
  }
664
649
  this.getBrowserStorage().setInteractionInProgress(false);
665
650
  throw e;
666
651
  });
667
652
  } else {
668
- const popupClient = this.createPopupClient(request.correlationId);
653
+ const popupClient = this.createPopupClient(correlationId);
669
654
  result = popupClient.acquireToken(request);
670
655
  }
671
656
 
@@ -876,7 +861,7 @@ export class StandardController implements IController {
876
861
  );
877
862
  const atbcMeasurement = this.performanceClient.startMeasurement(
878
863
  PerformanceEvents.AcquireTokenByCode,
879
- request.correlationId
864
+ correlationId
880
865
  );
881
866
 
882
867
  try {
@@ -934,7 +919,7 @@ export class StandardController implements IController {
934
919
  } else {
935
920
  this.logger.verbose(
936
921
  "Existing acquireTokenByCode request found",
937
- request.correlationId
922
+ correlationId
938
923
  );
939
924
  atbcMeasurement.discard();
940
925
  }
@@ -942,7 +927,10 @@ export class StandardController implements IController {
942
927
  } else if (request.nativeAccountId) {
943
928
  if (this.canUseNative(request, request.nativeAccountId)) {
944
929
  return this.acquireTokenNative(
945
- request,
930
+ {
931
+ ...request,
932
+ correlationId,
933
+ },
946
934
  ApiId.acquireTokenByCode,
947
935
  request.nativeAccountId
948
936
  ).catch((e: AuthError) => {
@@ -1047,13 +1035,13 @@ export class StandardController implements IController {
1047
1035
  protected async acquireTokenFromCache(
1048
1036
  silentCacheClient: SilentCacheClient,
1049
1037
  commonRequest: CommonSilentFlowRequest,
1050
- silentRequest: SilentRequest
1038
+ cacheLookupPolicy: CacheLookupPolicy
1051
1039
  ): Promise<AuthenticationResult> {
1052
1040
  this.performanceClient.addQueueMeasurement(
1053
1041
  PerformanceEvents.AcquireTokenFromCache,
1054
1042
  commonRequest.correlationId
1055
1043
  );
1056
- switch (silentRequest.cacheLookupPolicy) {
1044
+ switch (cacheLookupPolicy) {
1057
1045
  case CacheLookupPolicy.Default:
1058
1046
  case CacheLookupPolicy.AccessToken:
1059
1047
  case CacheLookupPolicy.AccessTokenAndRefreshToken:
@@ -1074,18 +1062,18 @@ export class StandardController implements IController {
1074
1062
  /**
1075
1063
  * Attempt to acquire an access token via a refresh token
1076
1064
  * @param commonRequest CommonSilentFlowRequest
1077
- * @param silentRequest SilentRequest
1065
+ * @param cacheLookupPolicy CacheLookupPolicy
1078
1066
  * @returns A promise that, when resolved, returns the access token
1079
1067
  */
1080
1068
  public async acquireTokenByRefreshToken(
1081
1069
  commonRequest: CommonSilentFlowRequest,
1082
- silentRequest: SilentRequest
1070
+ cacheLookupPolicy: CacheLookupPolicy
1083
1071
  ): Promise<AuthenticationResult> {
1084
1072
  this.performanceClient.addQueueMeasurement(
1085
1073
  PerformanceEvents.AcquireTokenByRefreshToken,
1086
1074
  commonRequest.correlationId
1087
1075
  );
1088
- switch (silentRequest.cacheLookupPolicy) {
1076
+ switch (cacheLookupPolicy) {
1089
1077
  case CacheLookupPolicy.Default:
1090
1078
  case CacheLookupPolicy.AccessTokenAndRefreshToken:
1091
1079
  case CacheLookupPolicy.RefreshToken:
@@ -1911,6 +1899,7 @@ export class StandardController implements IController {
1911
1899
  resourceRequestUri: request.resourceRequestUri,
1912
1900
  shrClaims: request.shrClaims,
1913
1901
  sshKid: request.sshKid,
1902
+ shrOptions: request.shrOptions,
1914
1903
  };
1915
1904
  const silentRequestKey = JSON.stringify(thumbprint);
1916
1905
 
@@ -2055,12 +2044,8 @@ export class StandardController implements IController {
2055
2044
  request.correlationId
2056
2045
  )(request, account);
2057
2046
 
2058
- const requestWithCLP = {
2059
- ...request,
2060
- // set the request's CacheLookupPolicy to Default if it was not optionally passed in
2061
- cacheLookupPolicy:
2062
- request.cacheLookupPolicy || CacheLookupPolicy.Default,
2063
- };
2047
+ const cacheLookupPolicy =
2048
+ request.cacheLookupPolicy || CacheLookupPolicy.Default;
2064
2049
 
2065
2050
  result = invokeAsync(
2066
2051
  this.acquireTokenFromCache.bind(this),
@@ -2068,10 +2053,10 @@ export class StandardController implements IController {
2068
2053
  this.logger,
2069
2054
  this.performanceClient,
2070
2055
  silentRequest.correlationId
2071
- )(silentCacheClient, silentRequest, requestWithCLP).catch(
2056
+ )(silentCacheClient, silentRequest, cacheLookupPolicy).catch(
2072
2057
  (cacheError: AuthError) => {
2073
2058
  if (
2074
- requestWithCLP.cacheLookupPolicy ===
2059
+ request.cacheLookupPolicy ===
2075
2060
  CacheLookupPolicy.AccessToken
2076
2061
  ) {
2077
2062
  throw cacheError;
@@ -2091,42 +2076,42 @@ export class StandardController implements IController {
2091
2076
  this.logger,
2092
2077
  this.performanceClient,
2093
2078
  silentRequest.correlationId
2094
- )(silentRequest, requestWithCLP).catch(
2079
+ )(silentRequest, cacheLookupPolicy).catch(
2095
2080
  (refreshTokenError: AuthError) => {
2096
- const isServerError =
2097
- refreshTokenError instanceof ServerError;
2098
- const isInteractionRequiredError =
2099
- refreshTokenError instanceof
2100
- InteractionRequiredAuthError;
2101
- const isInvalidGrantError =
2081
+ const isSilentlyResolvable =
2082
+ (!(
2083
+ refreshTokenError instanceof
2084
+ InteractionRequiredAuthError
2085
+ ) &&
2086
+ (refreshTokenError.errorCode ===
2087
+ BrowserConstants.INVALID_GRANT_ERROR ||
2088
+ refreshTokenError.errorCode ===
2089
+ ClientAuthErrorCodes.tokenRefreshRequired)) ||
2102
2090
  refreshTokenError.errorCode ===
2103
- BrowserConstants.INVALID_GRANT_ERROR;
2104
-
2105
- if (
2106
- (!isServerError ||
2107
- !isInvalidGrantError ||
2108
- isInteractionRequiredError ||
2109
- requestWithCLP.cacheLookupPolicy ===
2110
- CacheLookupPolicy.AccessTokenAndRefreshToken ||
2111
- requestWithCLP.cacheLookupPolicy ===
2112
- CacheLookupPolicy.RefreshToken) &&
2113
- requestWithCLP.cacheLookupPolicy !==
2114
- CacheLookupPolicy.Skip
2115
- ) {
2091
+ InteractionRequiredAuthErrorCodes.noTokensFound;
2092
+
2093
+ const tryIframeRenewal =
2094
+ cacheLookupPolicy ===
2095
+ CacheLookupPolicy.Default ||
2096
+ cacheLookupPolicy === CacheLookupPolicy.Skip ||
2097
+ cacheLookupPolicy ===
2098
+ CacheLookupPolicy.RefreshTokenAndNetwork;
2099
+
2100
+ if (isSilentlyResolvable && tryIframeRenewal) {
2101
+ this.logger.verbose(
2102
+ "Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",
2103
+ request.correlationId
2104
+ );
2105
+ return invokeAsync(
2106
+ this.acquireTokenBySilentIframe.bind(this),
2107
+ PerformanceEvents.AcquireTokenBySilentIframe,
2108
+ this.logger,
2109
+ this.performanceClient,
2110
+ silentRequest.correlationId
2111
+ )(silentRequest);
2112
+ } else {
2116
2113
  throw refreshTokenError;
2117
2114
  }
2118
-
2119
- this.logger.verbose(
2120
- "Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",
2121
- request.correlationId
2122
- );
2123
- return invokeAsync(
2124
- this.acquireTokenBySilentIframe.bind(this),
2125
- PerformanceEvents.AcquireTokenBySilentIframe,
2126
- this.logger,
2127
- this.performanceClient,
2128
- silentRequest.correlationId
2129
- )(silentRequest);
2130
2115
  }
2131
2116
  );
2132
2117
  }
@@ -9,6 +9,7 @@ import {
9
9
  JoseHeader,
10
10
  Logger,
11
11
  PerformanceEvents,
12
+ ShrOptions,
12
13
  SignedHttpRequest,
13
14
  SignedHttpRequestParameters,
14
15
  } from "@azure/msal-common";
@@ -161,6 +162,7 @@ export class CryptoOps implements ICrypto {
161
162
  async signJwt(
162
163
  payload: SignedHttpRequest,
163
164
  kid: string,
165
+ shrOptions?: ShrOptions,
164
166
  correlationId?: string
165
167
  ): Promise<string> {
166
168
  const signJwtMeasurement = this.performanceClient?.startMeasurement(
@@ -180,15 +182,15 @@ export class CryptoOps implements ICrypto {
180
182
  cachedKeyPair.publicKey
181
183
  );
182
184
  const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
183
-
184
185
  // Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
185
186
  const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
186
-
187
187
  // Generate header
188
188
  const shrHeader = JoseHeader.getShrHeaderString({
189
- kid: encodedKeyIdThumbprint,
189
+ ...shrOptions?.header,
190
190
  alg: publicKeyJwk.alg,
191
+ kid: encodedKeyIdThumbprint,
191
192
  });
193
+
192
194
  const encodedShrHeader = urlEncode(shrHeader);
193
195
 
194
196
  // Generate payload
package/src/index.ts CHANGED
@@ -135,6 +135,7 @@ export {
135
135
  // Utils
136
136
  StringUtils,
137
137
  UrlString,
138
+ JsonWebTokenTypes,
138
139
  // AzureCloudInstance enum
139
140
  AzureCloudInstance,
140
141
  AzureCloudOptions,
@@ -141,7 +141,7 @@ export abstract class BaseInteractionClient {
141
141
  ): Promise<BaseAuthRequest> {
142
142
  this.performanceClient.addQueueMeasurement(
143
143
  PerformanceEvents.InitializeBaseRequest,
144
- request.correlationId
144
+ this.correlationId
145
145
  );
146
146
  const authority = request.authority || this.config.auth.authority;
147
147
 
@@ -266,7 +266,6 @@ export abstract class BaseInteractionClient {
266
266
  /**
267
267
  * Used to get a discovered version of the default authority.
268
268
  * @param requestAuthority
269
- * @param requestCorrelationId
270
269
  */
271
270
  protected async getDiscoveredAuthority(
272
271
  requestAuthority?: string
@@ -33,6 +33,7 @@ import {
33
33
  invokeAsync,
34
34
  createAuthError,
35
35
  AuthErrorCodes,
36
+ CacheHelpers,
36
37
  } from "@azure/msal-common";
37
38
  import { BaseInteractionClient } from "./BaseInteractionClient";
38
39
  import { BrowserConfiguration } from "../config/Configuration";
@@ -656,7 +657,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
656
657
  reqTimestamp: number
657
658
  ): void {
658
659
  const cachedIdToken: IdTokenEntity | null =
659
- IdTokenEntity.createIdTokenEntity(
660
+ CacheHelpers.createIdTokenEntity(
660
661
  homeAccountIdentifier,
661
662
  request.authority,
662
663
  response.id_token || "",
@@ -675,7 +676,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
675
676
  const responseScopes = this.generateScopes(response, request);
676
677
 
677
678
  const cachedAccessToken: AccessTokenEntity | null =
678
- AccessTokenEntity.createAccessTokenEntity(
679
+ CacheHelpers.createAccessTokenEntity(
679
680
  homeAccountIdentifier,
680
681
  request.authority,
681
682
  responseAccessToken,
@@ -684,7 +685,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
684
685
  responseScopes.printScopes(),
685
686
  tokenExpirationSeconds,
686
687
  0,
687
- this.browserCrypto
688
+ base64Decode
688
689
  );
689
690
 
690
691
  const nativeCacheRecord = new CacheRecord(