@azure/msal-browser 5.25.1 → 5.27.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 (516) hide show
  1. package/README.md +2 -0
  2. package/dist/app/IPublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientApplication.mjs +54 -14
  4. package/dist/app/PublicClientApplication.mjs.map +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  7. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
  9. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +1 -1
  10. package/dist/cache/AccountManager.mjs +1 -1
  11. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  12. package/dist/cache/BrowserCacheManager.mjs +1 -1
  13. package/dist/cache/CacheHelpers.mjs +1 -1
  14. package/dist/cache/CacheKeys.mjs +1 -1
  15. package/dist/cache/CookieStorage.mjs +1 -1
  16. package/dist/cache/DatabaseStorage.mjs +1 -1
  17. package/dist/cache/EncryptedData.mjs +1 -1
  18. package/dist/cache/LocalStorage.mjs +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/SessionStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.mjs +1 -1
  22. package/dist/config/Configuration.mjs +32 -4
  23. package/dist/config/Configuration.mjs.map +1 -1
  24. package/dist/controllers/NestedAppAuthController.mjs +7 -2
  25. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  26. package/dist/controllers/StandardController.mjs +36 -5
  27. package/dist/controllers/StandardController.mjs.map +1 -1
  28. package/dist/crypto/BrowserCrypto.mjs +1 -1
  29. package/dist/crypto/CryptoOps.mjs +1 -1
  30. package/dist/crypto/PkceGenerator.mjs +1 -1
  31. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  32. package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
  33. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  34. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  35. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +49 -19
  36. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  37. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  38. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  39. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +8 -7
  56. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -1
  57. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +4 -3
  58. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -1
  59. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +174 -0
  60. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs.map +1 -0
  61. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +67 -17
  62. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  63. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +3 -4
  64. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
  65. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +7 -15
  66. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  67. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
  68. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
  69. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +1 -5
  70. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  71. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +3 -2
  72. package/dist/custom_auth/core/error/CustomAuthApiError.mjs.map +1 -1
  73. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  74. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  75. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  76. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  77. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  78. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  79. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  80. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  81. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  82. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  83. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  84. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  85. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  86. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  87. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  88. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  89. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  90. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  91. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  92. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  93. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  94. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +61 -52
  95. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  96. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +6 -3
  97. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -1
  98. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +1 -1
  99. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  100. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  101. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  102. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +1 -2
  109. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  110. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +12 -10
  111. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs.map +1 -1
  112. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +1 -1
  113. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +3 -3
  114. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs.map +1 -1
  115. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +3 -7
  117. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +2 -1
  119. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs.map +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +1 -1
  122. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  123. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  124. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +1 -1
  125. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  126. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +8 -2
  127. package/dist/custom_auth/core/utils/ArgumentValidator.mjs.map +1 -1
  128. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  129. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  130. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  131. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  132. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  133. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  134. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  135. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  136. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  137. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  138. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  139. package/dist/custom_auth/index.mjs +2 -11
  140. package/dist/custom_auth/index.mjs.map +1 -1
  141. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  142. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  143. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  144. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  145. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  146. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  147. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  148. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  149. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  150. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  151. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  152. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +1 -3
  153. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  154. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  155. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  156. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  157. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  158. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  159. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  160. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  161. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  162. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  163. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  164. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  165. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  166. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  167. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +5 -5
  168. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
  169. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +5 -16
  170. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -1
  171. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +35 -0
  172. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs.map +1 -0
  173. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  174. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  175. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  176. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  177. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  178. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  179. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  180. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  181. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  182. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  183. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  184. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  185. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  186. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  187. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -3
  188. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -1
  189. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
  190. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -3
  191. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +1 -1
  193. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  194. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  195. package/dist/encode/Base64Decode.mjs +1 -1
  196. package/dist/encode/Base64Encode.mjs +1 -1
  197. package/dist/error/BrowserAuthError.mjs +1 -1
  198. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  199. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  200. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  201. package/dist/error/NativeAuthError.mjs +1 -1
  202. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  203. package/dist/error/NestedAppAuthError.mjs +1 -1
  204. package/dist/event/EventHandler.mjs +1 -1
  205. package/dist/event/EventMessage.mjs +1 -1
  206. package/dist/event/EventType.mjs +1 -1
  207. package/dist/index.mjs +1 -1
  208. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  209. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  210. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +1 -1
  211. package/dist/interaction_client/PopupClient.mjs +31 -3
  212. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  213. package/dist/interaction_client/RedirectClient.mjs +5 -5
  214. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  215. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  216. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  217. package/dist/interaction_client/SilentIframeClient.mjs +4 -3
  218. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  219. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  220. package/dist/interaction_client/StandardInteractionClient.mjs +7 -1
  221. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  222. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  223. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  224. package/dist/log-strings-mapping.json +27 -7
  225. package/dist/naa/BridgeError.mjs +1 -1
  226. package/dist/naa/BridgeProxy.mjs +1 -1
  227. package/dist/naa/BridgeStatusCode.mjs +1 -1
  228. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  229. package/dist/navigation/NavigationClient.mjs +1 -1
  230. package/dist/network/FetchClient.mjs +1 -1
  231. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  232. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  233. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  234. package/dist/packageMetadata.mjs +2 -2
  235. package/dist/popup_relay/constants.mjs +1 -1
  236. package/dist/popup_relay/index.mjs +1 -1
  237. package/dist/popup_relay/relayClient.mjs +1 -1
  238. package/dist/protocol/Authorize.mjs +23 -13
  239. package/dist/protocol/Authorize.mjs.map +1 -1
  240. package/dist/redirect_bridge/index.mjs +1 -1
  241. package/dist/request/RequestHelpers.mjs +1 -1
  242. package/dist/request/SilentRequestHelpers.mjs +9 -3
  243. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  244. package/dist/response/ResponseHandler.mjs +1 -1
  245. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  246. package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
  247. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  248. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  249. package/dist/utils/BrowserConstants.mjs +1 -1
  250. package/dist/utils/BrowserDetection.mjs +53 -0
  251. package/dist/utils/BrowserDetection.mjs.map +1 -0
  252. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  253. package/dist/utils/BrowserUtils.mjs +7 -2
  254. package/dist/utils/BrowserUtils.mjs.map +1 -1
  255. package/dist/utils/Helpers.mjs +1 -1
  256. package/dist/utils/IframeMonitor.mjs +81 -0
  257. package/dist/utils/IframeMonitor.mjs.map +1 -0
  258. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  259. package/dist/utils/PopupMonitor.mjs +119 -0
  260. package/dist/utils/PopupMonitor.mjs.map +1 -0
  261. package/dist/utils/PopupOriginCheck.mjs +88 -0
  262. package/dist/utils/PopupOriginCheck.mjs.map +1 -0
  263. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  264. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  265. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  266. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  267. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  268. package/dist/webBrokerBridge/index.mjs +1 -1
  269. package/lib/custom-auth-path/log-strings-mapping.json +27 -7
  270. package/lib/custom-auth-path/msal-custom-auth.cjs +1157 -718
  271. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  272. package/lib/custom-auth-path/msal-custom-auth.js +1157 -718
  273. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  274. package/lib/log-strings-mapping.json +27 -3
  275. package/lib/msal-browser.cjs +678 -134
  276. package/lib/msal-browser.cjs.map +1 -1
  277. package/lib/msal-browser.js +678 -134
  278. package/lib/msal-browser.js.map +1 -1
  279. package/lib/msal-browser.min.js +2 -2
  280. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  281. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  282. package/lib/popup-relay/msal-popup-relay.js +2 -2
  283. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  284. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  285. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  286. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  287. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  288. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  289. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  290. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  291. package/package.json +2 -2
  292. package/src/app/PublicClientApplication.ts +108 -8
  293. package/src/config/Configuration.ts +63 -6
  294. package/src/controllers/NestedAppAuthController.ts +6 -1
  295. package/src/controllers/StandardController.ts +46 -3
  296. package/src/custom_auth/CustomAuthActionInputs.ts +16 -6
  297. package/src/custom_auth/controller/CustomAuthStandardController.ts +78 -17
  298. package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +18 -30
  299. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +1 -0
  300. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.ts +239 -0
  301. package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +2 -5
  302. package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +0 -2
  303. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +13 -10
  304. package/src/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.ts +19 -0
  305. package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +3 -6
  306. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +4 -6
  307. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +114 -17
  308. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +6 -3
  309. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +17 -19
  310. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +5 -5
  311. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +0 -4
  312. package/src/custom_auth/core/error/CustomAuthApiError.ts +2 -1
  313. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +3 -4
  314. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +75 -68
  315. package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +6 -3
  316. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +2 -4
  317. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +0 -1
  318. package/src/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.ts +17 -15
  319. package/src/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.ts +1 -1
  320. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +3 -11
  321. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +2 -3
  322. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.ts +1 -0
  323. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +2 -0
  324. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +1 -1
  325. package/src/custom_auth/core/utils/ArgumentValidator.ts +13 -0
  326. package/src/custom_auth/index.ts +4 -14
  327. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -10
  328. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +0 -2
  329. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +3 -6
  330. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -4
  331. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -4
  332. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +5 -4
  333. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +4 -23
  334. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.ts +56 -0
  335. package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +1 -5
  336. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -5
  337. package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +0 -2
  338. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +0 -2
  339. package/src/interaction_client/PopupClient.ts +45 -1
  340. package/src/interaction_client/RedirectClient.ts +9 -5
  341. package/src/interaction_client/SilentIframeClient.ts +9 -2
  342. package/src/interaction_client/StandardInteractionClient.ts +6 -0
  343. package/src/packageMetadata.ts +1 -1
  344. package/src/protocol/Authorize.ts +34 -28
  345. package/src/request/SilentRequestHelpers.ts +11 -2
  346. package/src/utils/BrowserDetection.ts +85 -0
  347. package/src/utils/BrowserUtils.ts +8 -1
  348. package/src/utils/IframeMonitor.ts +98 -0
  349. package/src/utils/PopupMonitor.ts +158 -0
  350. package/src/utils/PopupOriginCheck.ts +94 -0
  351. package/types/app/PublicClientApplication.d.ts +6 -4
  352. package/types/app/PublicClientApplication.d.ts.map +1 -1
  353. package/types/config/Configuration.d.ts +16 -0
  354. package/types/config/Configuration.d.ts.map +1 -1
  355. package/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  356. package/types/controllers/StandardController.d.ts.map +1 -1
  357. package/types/custom_auth/CustomAuthActionInputs.d.ts +16 -5
  358. package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
  359. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  360. package/types/custom_auth/controller/CustomAuthStandardController.d.ts +1 -0
  361. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  362. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +9 -11
  363. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -1
  364. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +1 -0
  365. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -1
  366. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts +90 -0
  367. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts.map +1 -0
  368. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +1 -2
  369. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +1 -1
  370. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +1 -2
  371. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -1
  372. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +8 -7
  373. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -1
  374. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts +13 -0
  375. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts.map +1 -0
  376. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +2 -3
  377. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -1
  378. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +5 -6
  379. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  380. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +9 -6
  381. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  382. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
  383. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +2 -2
  384. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  385. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +5 -3
  386. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  387. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  388. package/types/custom_auth/core/error/CustomAuthApiError.d.ts +2 -1
  389. package/types/custom_auth/core/error/CustomAuthApiError.d.ts.map +1 -1
  390. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -3
  391. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  392. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +2 -2
  393. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  394. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +2 -2
  395. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -1
  396. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +2 -4
  397. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  398. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +0 -1
  399. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  400. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts +2 -2
  401. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts.map +1 -1
  402. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts +1 -1
  403. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts.map +1 -1
  404. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  405. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +1 -2
  406. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  407. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts +2 -0
  408. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -1
  409. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +1 -1
  410. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  411. package/types/custom_auth/core/utils/ArgumentValidator.d.ts +1 -0
  412. package/types/custom_auth/core/utils/ArgumentValidator.d.ts.map +1 -1
  413. package/types/custom_auth/index.d.ts +3 -12
  414. package/types/custom_auth/index.d.ts.map +1 -1
  415. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +5 -7
  416. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  417. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  418. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +4 -6
  419. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -1
  420. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +3 -4
  421. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  422. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +3 -4
  423. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
  424. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
  425. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +4 -9
  426. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -1
  427. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts +9 -0
  428. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts.map +1 -0
  429. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +1 -2
  430. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -1
  431. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +1 -2
  432. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  433. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -1
  434. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +1 -1
  435. package/types/interaction_client/PopupClient.d.ts +12 -0
  436. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  437. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  438. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  439. package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  440. package/types/packageMetadata.d.ts +1 -1
  441. package/types/protocol/Authorize.d.ts.map +1 -1
  442. package/types/request/SilentRequestHelpers.d.ts +1 -1
  443. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  444. package/types/utils/BrowserDetection.d.ts +17 -0
  445. package/types/utils/BrowserDetection.d.ts.map +1 -0
  446. package/types/utils/BrowserUtils.d.ts +2 -1
  447. package/types/utils/BrowserUtils.d.ts.map +1 -1
  448. package/types/utils/IframeMonitor.d.ts +17 -0
  449. package/types/utils/IframeMonitor.d.ts.map +1 -0
  450. package/types/utils/PopupMonitor.d.ts +37 -0
  451. package/types/utils/PopupMonitor.d.ts.map +1 -0
  452. package/types/utils/PopupOriginCheck.d.ts +27 -0
  453. package/types/utils/PopupOriginCheck.d.ts.map +1 -0
  454. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs +0 -102
  455. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs.map +0 -1
  456. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs +0 -20
  457. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs.map +0 -1
  458. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs +0 -36
  459. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs.map +0 -1
  460. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs +0 -29
  461. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs.map +0 -1
  462. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs +0 -36
  463. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs.map +0 -1
  464. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs +0 -61
  465. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs.map +0 -1
  466. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs +0 -29
  467. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs.map +0 -1
  468. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs +0 -18
  469. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs.map +0 -1
  470. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs +0 -37
  471. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs.map +0 -1
  472. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs +0 -23
  473. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs.map +0 -1
  474. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs +0 -25
  475. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs.map +0 -1
  476. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs +0 -33
  477. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs.map +0 -1
  478. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.ts +0 -146
  479. package/src/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.ts +0 -15
  480. package/src/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.ts +0 -33
  481. package/src/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.ts +0 -25
  482. package/src/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.ts +0 -18
  483. package/src/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.ts +0 -59
  484. package/src/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.ts +0 -76
  485. package/src/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.ts +0 -25
  486. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.ts +0 -13
  487. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.ts +0 -35
  488. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.ts +0 -19
  489. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.ts +0 -21
  490. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.ts +0 -32
  491. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts +0 -40
  492. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts.map +0 -1
  493. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts +0 -11
  494. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts.map +0 -1
  495. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts +0 -23
  496. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts.map +0 -1
  497. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts +0 -18
  498. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts.map +0 -1
  499. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts +0 -7
  500. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts.map +0 -1
  501. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts +0 -17
  502. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts.map +0 -1
  503. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts +0 -18
  504. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts.map +0 -1
  505. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts +0 -18
  506. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts.map +0 -1
  507. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts +0 -9
  508. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts.map +0 -1
  509. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts +0 -22
  510. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts.map +0 -1
  511. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts +0 -12
  512. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts.map +0 -1
  513. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts +0 -14
  514. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts.map +0 -1
  515. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts +0 -20
  516. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v5.25.1 2026-10-13 */
1
+ /*! @azure/msal-browser v5.27.0 2026-10-27 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -54,9 +54,15 @@ const EAR_JWK = "ear_jwk";
54
54
  const EAR_JWE_CRYPTO = "ear_jwe_crypto";
55
55
  const RESOURCE = "resource";
56
56
  const CLI_DATA = "clidata";
57
- const ATTRIBUTE_TOKENS = "attribute_tokens";
57
+ const ATTRIBUTE_TOKENS = "attribute_tokens";
58
+ /**
59
+ * Popup-origin-check-done. Signals to the STS that the client verified the
60
+ * popup cannot be reached by an untrusted window, so the
61
+ * Cross-Origin-Opener-Policy response header may be omitted.
62
+ */
63
+ const POPUP_ORIGIN_CHECK_DONE = "pocd";
58
64
 
59
- /*! @azure/msal-common v16.14.2 2026-10-13 */
65
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
60
66
  /*
61
67
  * Copyright (c) Microsoft Corporation. All rights reserved.
62
68
  * Licensed under the MIT License.
@@ -290,7 +296,7 @@ const JsonWebTokenTypes = {
290
296
  // Token renewal offset default in seconds
291
297
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
292
298
 
293
- /*! @azure/msal-common v16.14.2 2026-10-13 */
299
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
294
300
  /*
295
301
  * Copyright (c) Microsoft Corporation. All rights reserved.
296
302
  * Licensed under the MIT License.
@@ -319,7 +325,7 @@ function createAuthError(code, correlationId, additionalMessage) {
319
325
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
320
326
  }
321
327
 
322
- /*! @azure/msal-common v16.14.2 2026-10-13 */
328
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
323
329
 
324
330
  /*
325
331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -342,7 +348,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
342
348
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
343
349
  }
344
350
 
345
- /*! @azure/msal-common v16.14.2 2026-10-13 */
351
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
346
352
  /*
347
353
  * Copyright (c) Microsoft Corporation. All rights reserved.
348
354
  * Licensed under the MIT License.
@@ -380,7 +386,7 @@ const methodNotImplemented = "method_not_implemented";
380
386
  const resourceParameterRequired = "resource_parameter_required";
381
387
  const misplacedResourceParam = "misplaced_resource_parameter";
382
388
 
383
- /*! @azure/msal-common v16.14.2 2026-10-13 */
389
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
384
390
 
385
391
  /*
386
392
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -418,7 +424,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
418
424
  };
419
425
  }
420
426
 
421
- /*! @azure/msal-common v16.14.2 2026-10-13 */
427
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
422
428
 
423
429
  /*
424
430
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -484,7 +490,7 @@ function getJWSPayload(authToken, correlationId) {
484
490
  return matches[2];
485
491
  }
486
492
 
487
- /*! @azure/msal-common v16.14.2 2026-10-13 */
493
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
488
494
 
489
495
  /*
490
496
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -572,7 +578,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
572
578
  return updatedAccountInfo;
573
579
  }
574
580
 
575
- /*! @azure/msal-common v16.14.2 2026-10-13 */
581
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
576
582
  /*
577
583
  * Copyright (c) Microsoft Corporation. All rights reserved.
578
584
  * Licensed under the MIT License.
@@ -586,7 +592,7 @@ const AuthorityType = {
586
592
  Ciam: 3,
587
593
  };
588
594
 
589
- /*! @azure/msal-common v16.14.2 2026-10-13 */
595
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
590
596
  /*
591
597
  * Copyright (c) Microsoft Corporation. All rights reserved.
592
598
  * Licensed under the MIT License.
@@ -608,7 +614,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
608
614
  return null;
609
615
  }
610
616
 
611
- /*! @azure/msal-common v16.14.2 2026-10-13 */
617
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
612
618
  /*
613
619
  * Copyright (c) Microsoft Corporation. All rights reserved.
614
620
  * Licensed under the MIT License.
@@ -632,7 +638,7 @@ const ProtocolMode = {
632
638
  EAR: "EAR",
633
639
  };
634
640
 
635
- /*! @azure/msal-common v16.14.2 2026-10-13 */
641
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
636
642
  /**
637
643
  * Returns the AccountInfo interface for this account.
638
644
  * @internal
@@ -821,7 +827,7 @@ function isAccountEntity(entity) {
821
827
  entity.hasOwnProperty("authorityType"));
822
828
  }
823
829
 
824
- /*! @azure/msal-common v16.14.2 2026-10-13 */
830
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
825
831
  /*
826
832
  * Copyright (c) Microsoft Corporation. All rights reserved.
827
833
  * Licensed under the MIT License.
@@ -831,7 +837,7 @@ function isAccountEntity(entity) {
831
837
  */
832
838
  const unexpectedError = "unexpected_error";
833
839
 
834
- /*! @azure/msal-common v16.14.2 2026-10-13 */
840
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
835
841
 
836
842
  /*
837
843
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -851,7 +857,47 @@ function createClientConfigurationError(errorCode, correlationId) {
851
857
  return new ClientConfigurationError(errorCode, correlationId);
852
858
  }
853
859
 
854
- /*! @azure/msal-common v16.14.2 2026-10-13 */
860
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
861
+ /*
862
+ * Copyright (c) Microsoft Corporation. All rights reserved.
863
+ * Licensed under the MIT License.
864
+ */
865
+ // Track only our normalized copies, never caller-owned mutable inputs.
866
+ const normalizedHeaderRecords = new WeakSet();
867
+ /**
868
+ * Creates a lowercase-keyed snapshot without changing header values or the input.
869
+ * Reuses snapshots produced by this function to avoid repeated normalization.
870
+ * @internal
871
+ */
872
+ function normalizeResponseHeaders(headers) {
873
+ if (normalizedHeaderRecords.has(headers)) {
874
+ return headers;
875
+ }
876
+ const normalized = Object.fromEntries(Object.entries(headers).map(([name, value]) => [
877
+ name.toLowerCase(),
878
+ value,
879
+ ]));
880
+ normalizedHeaderRecords.add(normalized);
881
+ return normalized;
882
+ }
883
+ /**
884
+ * Reads a response header case-insensitively.
885
+ * Normalized snapshots are never scanned, even when a header is missing.
886
+ * @internal
887
+ */
888
+ function getResponseHeader(headers, name) {
889
+ const key = name.toLowerCase();
890
+ if (Object.prototype.hasOwnProperty.call(headers, key)) {
891
+ return headers[key];
892
+ }
893
+ if (normalizedHeaderRecords.has(headers)) {
894
+ return undefined;
895
+ }
896
+ const headerName = Object.keys(headers).find((header) => header.toLowerCase() === key);
897
+ return headerName === undefined ? undefined : headers[headerName];
898
+ }
899
+
900
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
855
901
  /*
856
902
  * Copyright (c) Microsoft Corporation. All rights reserved.
857
903
  * Licensed under the MIT License.
@@ -882,7 +928,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
882
928
  const invalidDpopNonce = "invalid_dpop_nonce";
883
929
  const dpopMissingResourceContext = "dpop_missing_resource_context";
884
930
 
885
- /*! @azure/msal-common v16.14.2 2026-10-13 */
931
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
886
932
  /*
887
933
  * Copyright (c) Microsoft Corporation. All rights reserved.
888
934
  * Licensed under the MIT License.
@@ -894,7 +940,7 @@ function isOpenIdConfigResponse(response) {
894
940
  response.hasOwnProperty("jwks_uri"));
895
941
  }
896
942
 
897
- /*! @azure/msal-common v16.14.2 2026-10-13 */
943
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
898
944
  /*
899
945
  * Copyright (c) Microsoft Corporation. All rights reserved.
900
946
  * Licensed under the MIT License.
@@ -974,7 +1020,7 @@ class StringUtils {
974
1020
  }
975
1021
  }
976
1022
 
977
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1023
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
978
1024
 
979
1025
  /*
980
1026
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1132,7 +1178,7 @@ class UrlString {
1132
1178
  }
1133
1179
  }
1134
1180
 
1135
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1181
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1136
1182
 
1137
1183
  /*
1138
1184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1286,7 +1332,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1286
1332
  return null;
1287
1333
  }
1288
1334
 
1289
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1335
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1290
1336
  /*
1291
1337
  * Copyright (c) Microsoft Corporation. All rights reserved.
1292
1338
  * Licensed under the MIT License.
@@ -1295,7 +1341,7 @@ const AzureCloudInstance = {
1295
1341
  // AzureCloudInstance is not specified.
1296
1342
  None: "none"};
1297
1343
 
1298
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1344
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1299
1345
  /*
1300
1346
  * Copyright (c) Microsoft Corporation. All rights reserved.
1301
1347
  * Licensed under the MIT License.
@@ -1305,7 +1351,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1305
1351
  response.hasOwnProperty("metadata"));
1306
1352
  }
1307
1353
 
1308
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1354
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1309
1355
  /*
1310
1356
  * Copyright (c) Microsoft Corporation. All rights reserved.
1311
1357
  * Licensed under the MIT License.
@@ -1315,7 +1361,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1315
1361
  response.hasOwnProperty("error_description"));
1316
1362
  }
1317
1363
 
1318
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1364
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1319
1365
  /*
1320
1366
  * Copyright (c) Microsoft Corporation. All rights reserved.
1321
1367
  * Licensed under the MIT License.
@@ -1386,7 +1432,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1386
1432
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1387
1433
  const SetUserData = "setUserData";
1388
1434
 
1389
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1435
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1390
1436
  /*
1391
1437
  * Copyright (c) Microsoft Corporation. All rights reserved.
1392
1438
  * Licensed under the MIT License.
@@ -1479,7 +1525,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1479
1525
  };
1480
1526
  };
1481
1527
 
1482
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1528
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1483
1529
 
1484
1530
  /*
1485
1531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1590,7 +1636,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1590
1636
  },
1591
1637
  };
1592
1638
 
1593
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1639
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1594
1640
  /*
1595
1641
  * Copyright (c) Microsoft Corporation. All rights reserved.
1596
1642
  * Licensed under the MIT License.
@@ -1655,7 +1701,7 @@ function wasClockTurnedBack(cachedAt) {
1655
1701
  return cachedAtSec > nowSeconds();
1656
1702
  }
1657
1703
 
1658
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1704
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1659
1705
 
1660
1706
  /*
1661
1707
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1942,7 +1988,7 @@ function serializeAttributeTokens(attributeTokens) {
1942
1988
  return [...attributeTokens].sort().join(" ");
1943
1989
  }
1944
1990
 
1945
- /*! @azure/msal-common v16.14.2 2026-10-13 */
1991
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
1946
1992
 
1947
1993
  /*
1948
1994
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2910,7 +2956,7 @@ function buildStaticAuthorityOptions(authOptions) {
2910
2956
  };
2911
2957
  }
2912
2958
 
2913
- /*! @azure/msal-common v16.14.2 2026-10-13 */
2959
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
2914
2960
 
2915
2961
  /*
2916
2962
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2944,7 +2990,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
2944
2990
  }
2945
2991
  }
2946
2992
 
2947
- /*! @azure/msal-common v16.14.2 2026-10-13 */
2993
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
2948
2994
 
2949
2995
  /*
2950
2996
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3140,7 +3186,7 @@ class ScopeSet {
3140
3186
  }
3141
3187
  }
3142
3188
 
3143
- /*! @azure/msal-common v16.14.2 2026-10-13 */
3189
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
3144
3190
 
3145
3191
  /*
3146
3192
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3421,6 +3467,20 @@ function addInstanceAware(parameters) {
3421
3467
  parameters.set(INSTANCE_AWARE, "true");
3422
3468
  }
3423
3469
  }
3470
+ /**
3471
+ * Adds `pocd=1`, telling the STS that the client verified the popup driving
3472
+ * this request cannot be reached by an untrusted window, so the
3473
+ * Cross-Origin-Opener-Policy response header may be omitted.
3474
+ *
3475
+ * Only ever added when the check passed — a negative result is signalled by
3476
+ * omitting the parameter, which keeps the STS default (apply COOP) and stays
3477
+ * compatible with library versions that never send it.
3478
+ */
3479
+ function addPopupOriginCheckDone(parameters) {
3480
+ if (!parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
3481
+ parameters.set(POPUP_ORIGIN_CHECK_DONE, "1");
3482
+ }
3483
+ }
3424
3484
  /**
3425
3485
  * Add extraParameters
3426
3486
  * @param extraParams - String dictionary containing extra parameters to be added.
@@ -3626,7 +3686,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3626
3686
  }
3627
3687
  }
3628
3688
 
3629
- /*! @azure/msal-common v16.14.2 2026-10-13 */
3689
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
3630
3690
 
3631
3691
  /*
3632
3692
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3647,7 +3707,8 @@ function stripLeadingHashOrQuery(responseString) {
3647
3707
  return responseString;
3648
3708
  }
3649
3709
  /**
3650
- * Returns URL hash as server auth code response object.
3710
+ * Returns flat fragment or query parameters as an authorization response.
3711
+ * Application routes and unrecognized responses return null.
3651
3712
  */
3652
3713
  function getDeserializedResponse(responseString) {
3653
3714
  // Check if given hash is empty
@@ -3657,7 +3718,15 @@ function getDeserializedResponse(responseString) {
3657
3718
  try {
3658
3719
  // Strip the # or ? symbol if present
3659
3720
  const normalizedResponse = stripLeadingHashOrQuery(responseString);
3660
- // If # symbol was not present, above will return empty string, so give original hash value
3721
+ /*
3722
+ * Require a flat parameter name, not an application route.
3723
+ * Reject routes like #/dashboard?tab=orders&code=... and
3724
+ * #/dashboard/orders&state=..., where ?, /, or # appears before
3725
+ * the first = or &. These characters are allowed in parameter values.
3726
+ */
3727
+ if (!/^[^=&?#/]+(?:=|&|$)/.test(normalizedResponse)) {
3728
+ return null;
3729
+ }
3661
3730
  const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
3662
3731
  // Check for known response properties
3663
3732
  if (deserializedHash.code ||
@@ -3748,7 +3817,7 @@ function validateUrl(url, logger, correlationId) {
3748
3817
  }
3749
3818
  }
3750
3819
 
3751
- /*! @azure/msal-common v16.14.2 2026-10-13 */
3820
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
3752
3821
 
3753
3822
  /*
3754
3823
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3796,7 +3865,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3796
3865
  },
3797
3866
  };
3798
3867
 
3799
- /*! @azure/msal-common v16.14.2 2026-10-13 */
3868
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
3800
3869
 
3801
3870
  /*
3802
3871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3819,7 +3888,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3819
3888
  },
3820
3889
  };
3821
3890
 
3822
- /*! @azure/msal-common v16.14.2 2026-10-13 */
3891
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
3823
3892
  /*
3824
3893
  * Copyright (c) Microsoft Corporation. All rights reserved.
3825
3894
  * Licensed under the MIT License.
@@ -4094,12 +4163,12 @@ class Logger {
4094
4163
  }
4095
4164
  }
4096
4165
 
4097
- /*! @azure/msal-common v16.14.2 2026-10-13 */
4166
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
4098
4167
  /* eslint-disable header/header */
4099
4168
  const name$1 = "@azure/msal-common";
4100
- const version$1 = "16.14.2";
4169
+ const version$1 = "16.15.0";
4101
4170
 
4102
- /*! @azure/msal-common v16.14.2 2026-10-13 */
4171
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
4103
4172
  /*
4104
4173
  * Copyright (c) Microsoft Corporation. All rights reserved.
4105
4174
  * Licensed under the MIT License.
@@ -4107,7 +4176,7 @@ const version$1 = "16.14.2";
4107
4176
  const cacheQuotaExceeded = "cache_quota_exceeded";
4108
4177
  const cacheErrorUnknown = "cache_error_unknown";
4109
4178
 
4110
- /*! @azure/msal-common v16.14.2 2026-10-13 */
4179
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
4111
4180
 
4112
4181
  /*
4113
4182
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4145,7 +4214,7 @@ function createCacheError(e) {
4145
4214
  }
4146
4215
  }
4147
4216
 
4148
- /*! @azure/msal-common v16.14.2 2026-10-13 */
4217
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
4149
4218
 
4150
4219
  /*
4151
4220
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5332,7 +5401,7 @@ class DefaultStorageClass extends CacheManager {
5332
5401
  }
5333
5402
  }
5334
5403
 
5335
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5404
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5336
5405
  /*
5337
5406
  * Copyright (c) Microsoft Corporation. All rights reserved.
5338
5407
  * Licensed under the MIT License.
@@ -5346,7 +5415,7 @@ class DefaultStorageClass extends CacheManager {
5346
5415
  const PerformanceEventStatus = {
5347
5416
  InProgress: 1};
5348
5417
 
5349
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5418
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5350
5419
 
5351
5420
  /*
5352
5421
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5404,7 +5473,7 @@ class StubPerformanceClient {
5404
5473
  }
5405
5474
  }
5406
5475
 
5407
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5476
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5408
5477
 
5409
5478
  /*
5410
5479
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5502,7 +5571,7 @@ function isOidcProtocolMode(config) {
5502
5571
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5503
5572
  }
5504
5573
 
5505
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5574
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5506
5575
  /*
5507
5576
  * Copyright (c) Microsoft Corporation. All rights reserved.
5508
5577
  * Licensed under the MIT License.
@@ -5529,7 +5598,7 @@ function isOidcProtocolMode(config) {
5529
5598
  }
5530
5599
  }
5531
5600
 
5532
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5601
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5533
5602
 
5534
5603
  /*
5535
5604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5550,7 +5619,7 @@ function createJoseHeaderError(code, correlationId) {
5550
5619
  return new JoseHeaderError(code, correlationId);
5551
5620
  }
5552
5621
 
5553
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5622
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5554
5623
  /*
5555
5624
  * Copyright (c) Microsoft Corporation. All rights reserved.
5556
5625
  * Licensed under the MIT License.
@@ -5575,7 +5644,7 @@ function isPlainObject(value) {
5575
5644
  return Object.getPrototypeOf(value) === proto;
5576
5645
  }
5577
5646
 
5578
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5647
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5579
5648
  /*
5580
5649
  * Copyright (c) Microsoft Corporation. All rights reserved.
5581
5650
  * Licensed under the MIT License.
@@ -5585,7 +5654,7 @@ const missingAlgError = "missing_alg_error";
5585
5654
  const missingJwkError = "missing_jwk_error";
5586
5655
  const invalidJwkError = "invalid_jwk_error";
5587
5656
 
5588
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5657
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5589
5658
 
5590
5659
  /*
5591
5660
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5651,7 +5720,7 @@ class JoseHeader {
5651
5720
  }
5652
5721
  }
5653
5722
 
5654
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5723
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5655
5724
 
5656
5725
  /*
5657
5726
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5752,7 +5821,7 @@ class PopTokenGenerator {
5752
5821
  }
5753
5822
  }
5754
5823
 
5755
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5824
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5756
5825
 
5757
5826
  /*
5758
5827
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5897,7 +5966,7 @@ class DpopProofGenerator {
5897
5966
  }
5898
5967
  }
5899
5968
 
5900
- /*! @azure/msal-common v16.14.2 2026-10-13 */
5969
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5901
5970
  /*
5902
5971
  * Copyright (c) Microsoft Corporation. All rights reserved.
5903
5972
  * Licensed under the MIT License.
@@ -5948,7 +6017,7 @@ const badToken = "bad_token";
5948
6017
  */
5949
6018
  const interruptedUser = "interrupted_user";
5950
6019
 
5951
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6020
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
5952
6021
 
5953
6022
  /*
5954
6023
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6015,7 +6084,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6015
6084
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6016
6085
  }
6017
6086
 
6018
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6087
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6019
6088
 
6020
6089
  /*
6021
6090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6034,7 +6103,7 @@ class ServerError extends AuthError {
6034
6103
  }
6035
6104
  }
6036
6105
 
6037
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6106
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6038
6107
 
6039
6108
  /*
6040
6109
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6105,7 +6174,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6105
6174
  }
6106
6175
  }
6107
6176
 
6108
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6177
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6109
6178
 
6110
6179
  /*
6111
6180
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6533,7 +6602,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6533
6602
  return baseAccount;
6534
6603
  }
6535
6604
 
6536
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6605
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6537
6606
  /*
6538
6607
  * Copyright (c) Microsoft Corporation. All rights reserved.
6539
6608
  * Licensed under the MIT License.
@@ -6543,7 +6612,7 @@ const CcsCredentialType = {
6543
6612
  UPN: "UPN",
6544
6613
  };
6545
6614
 
6546
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6615
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6547
6616
  /*
6548
6617
  * Copyright (c) Microsoft Corporation. All rights reserved.
6549
6618
  * Licensed under the MIT License.
@@ -6562,7 +6631,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6562
6631
  }
6563
6632
  }
6564
6633
 
6565
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6634
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6566
6635
 
6567
6636
  /*
6568
6637
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6586,7 +6655,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6586
6655
  };
6587
6656
  }
6588
6657
 
6589
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6658
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6590
6659
 
6591
6660
  /*
6592
6661
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6621,13 +6690,14 @@ class ThrottlingUtils {
6621
6690
  * Performs necessary throttling checks after a network request.
6622
6691
  * @param cacheManager
6623
6692
  * @param thumbprint
6624
- * @param response
6693
+ * @param response - Token response with case-insensitive header names.
6625
6694
  */
6626
6695
  static postProcess(cacheManager, thumbprint, response, correlationId) {
6696
+ const retryAfter = getRetryAfterHeader(response);
6627
6697
  if (ThrottlingUtils.checkResponseStatus(response) ||
6628
- ThrottlingUtils.checkResponseForRetryAfter(response)) {
6698
+ retryAfter !== undefined) {
6629
6699
  const thumbprintValue = {
6630
- throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
6700
+ throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(retryAfter || "")),
6631
6701
  error: response.body.error,
6632
6702
  errorCodes: response.body.error_codes,
6633
6703
  errorMessage: response.body.error_description,
@@ -6646,14 +6716,10 @@ class ThrottlingUtils {
6646
6716
  }
6647
6717
  /**
6648
6718
  * Checks a NetworkResponse object's RetryAfter header
6649
- * @param response
6719
+ * @param response - Token response with case-insensitive header names.
6650
6720
  */
6651
6721
  static checkResponseForRetryAfter(response) {
6652
- if (response.headers) {
6653
- return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
6654
- (response.status < 200 || response.status >= 300));
6655
- }
6656
- return false;
6722
+ return getRetryAfterHeader(response) !== undefined;
6657
6723
  }
6658
6724
  /**
6659
6725
  * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
@@ -6670,9 +6736,16 @@ class ThrottlingUtils {
6670
6736
  const key = this.generateThrottlingStorageKey(thumbprint);
6671
6737
  cacheManager.removeItem(key, request.correlationId);
6672
6738
  }
6739
+ }
6740
+ /** Reads Retry-After only for non-success responses. */
6741
+ function getRetryAfterHeader(response) {
6742
+ if ((response.status < 200 || response.status >= 300) && response.headers) {
6743
+ return getResponseHeader(response.headers, HeaderNames.RETRY_AFTER);
6744
+ }
6745
+ return undefined;
6673
6746
  }
6674
6747
 
6675
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6748
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6676
6749
 
6677
6750
  /*
6678
6751
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6703,7 +6776,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6703
6776
  return new NetworkError(error, httpStatus, responseHeaders);
6704
6777
  }
6705
6778
 
6706
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6779
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6707
6780
 
6708
6781
  /*
6709
6782
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6801,7 +6874,8 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6801
6874
  let response;
6802
6875
  try {
6803
6876
  response = await invokeAsync((networkClient.sendPostRequestAsync.bind(networkClient)), NetworkClientSendPostRequestAsync, logger, performanceClient, correlationId)(tokenEndpoint, { ...options, correlationId, performanceClient });
6804
- const responseHeaders = response.headers || {};
6877
+ const responseHeaders = normalizeResponseHeaders(response.headers || {});
6878
+ response = { ...response, headers: responseHeaders };
6805
6879
  performanceClient?.addFields({
6806
6880
  refreshTokenSize: response.body.refresh_token?.length || 0,
6807
6881
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
@@ -6810,16 +6884,16 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6810
6884
  }
6811
6885
  catch (e) {
6812
6886
  if (e instanceof NetworkError) {
6813
- const responseHeaders = e.responseHeaders;
6887
+ const responseHeaders = e.responseHeaders
6888
+ ? normalizeResponseHeaders(e.responseHeaders)
6889
+ : undefined;
6814
6890
  if (responseHeaders) {
6815
6891
  performanceClient?.addFields({
6816
6892
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] ||
6817
6893
  "",
6818
6894
  requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
6819
- contentTypeHeader: responseHeaders[HeaderNames.CONTENT_TYPE] ||
6820
- undefined,
6821
- contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] ||
6822
- undefined,
6895
+ contentTypeHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_TYPE) || undefined,
6896
+ contentLengthHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_LENGTH) || undefined,
6823
6897
  httpStatus: e.httpStatus,
6824
6898
  }, correlationId);
6825
6899
  }
@@ -6836,7 +6910,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6836
6910
  return response;
6837
6911
  }
6838
6912
 
6839
- /*! @azure/msal-common v16.14.2 2026-10-13 */
6913
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
6840
6914
 
6841
6915
  /*
6842
6916
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7080,6 +7154,9 @@ class AuthorizationCodeClient {
7080
7154
  if (request.logoutHint) {
7081
7155
  addLogoutHint(parameters, request.logoutHint);
7082
7156
  }
7157
+ if (request.popupOriginCheckDone) {
7158
+ addPopupOriginCheckDone(parameters);
7159
+ }
7083
7160
  if (request.extraQueryParameters) {
7084
7161
  addExtraParameters(parameters, request.extraQueryParameters);
7085
7162
  }
@@ -7100,7 +7177,7 @@ class AuthorizationCodeClient {
7100
7177
  }
7101
7178
  }
7102
7179
 
7103
- /*! @azure/msal-common v16.14.2 2026-10-13 */
7180
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
7104
7181
 
7105
7182
  /*
7106
7183
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7235,6 +7312,9 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
7235
7312
  !Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
7236
7313
  addInstanceAware(parameters);
7237
7314
  }
7315
+ if (request.popupOriginCheckDone) {
7316
+ addPopupOriginCheckDone(parameters);
7317
+ }
7238
7318
  return parameters;
7239
7319
  }
7240
7320
  /**
@@ -7327,7 +7407,7 @@ function extractLoginHint(account) {
7327
7407
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7328
7408
  }
7329
7409
 
7330
- /*! @azure/msal-common v16.14.2 2026-10-13 */
7410
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
7331
7411
 
7332
7412
  /*
7333
7413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7562,7 +7642,7 @@ class RefreshTokenClient {
7562
7642
  }
7563
7643
  }
7564
7644
 
7565
- /*! @azure/msal-common v16.14.2 2026-10-13 */
7645
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
7566
7646
 
7567
7647
  /*
7568
7648
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7855,7 +7935,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
7855
7935
  clearNativeBrokerErrorCode() { }
7856
7936
  }
7857
7937
 
7858
- /*! @azure/msal-common v16.14.2 2026-10-13 */
7938
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
7859
7939
 
7860
7940
  /*
7861
7941
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7982,7 +8062,7 @@ class SilentFlowClient {
7982
8062
  }
7983
8063
  }
7984
8064
 
7985
- /*! @azure/msal-common v16.14.2 2026-10-13 */
8065
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
7986
8066
 
7987
8067
  /*
7988
8068
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7998,7 +8078,7 @@ const StubbedNetworkModule = {
7998
8078
  },
7999
8079
  };
8000
8080
 
8001
- /*! @azure/msal-common v16.14.2 2026-10-13 */
8081
+ /*! @azure/msal-common v16.15.0 2026-10-27 */
8002
8082
 
8003
8083
  /*
8004
8084
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8153,13 +8233,14 @@ class RedirectError extends CustomAuthError {
8153
8233
  * Custom Auth API error.
8154
8234
  */
8155
8235
  class CustomAuthApiError extends CustomAuthError {
8156
- constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp, attributeValidationDetails) {
8236
+ constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp, attributeValidationDetails, innerErrorCode) {
8157
8237
  super(error, errorDescription, correlationId, errorCodes, subError);
8158
8238
  this.attributes = attributes;
8159
8239
  this.continuationToken = continuationToken;
8160
8240
  this.traceId = traceId;
8161
8241
  this.timestamp = timestamp;
8162
8242
  this.attributeValidationDetails = attributeValidationDetails;
8243
+ this.innerErrorCode = innerErrorCode;
8163
8244
  Object.setPrototypeOf(this, CustomAuthApiError.prototype);
8164
8245
  }
8165
8246
  }
@@ -8201,7 +8282,7 @@ const INVALID_EXPIRES_IN = "invalid_expires_in";
8201
8282
  const INVALID_TOKEN_TYPE = "invalid_token_type";
8202
8283
  const HTTP_REQUEST_FAILED$1 = "http_request_failed";
8203
8284
  const INVALID_REQUEST = "invalid_request";
8204
- const USER_NOT_FOUND = "user_not_found";
8285
+ const USER_NOT_FOUND$1 = "user_not_found";
8205
8286
  const INVALID_GRANT = "invalid_grant";
8206
8287
  const CREDENTIAL_REQUIRED = "credential_required";
8207
8288
  const ATTRIBUTES_REQUIRED = "attributes_required";
@@ -8241,7 +8322,7 @@ class AuthFlowErrorBase {
8241
8322
  this.errorData = errorData;
8242
8323
  }
8243
8324
  isUserNotFoundError() {
8244
- return this.errorData.error === USER_NOT_FOUND;
8325
+ return this.errorData.error === USER_NOT_FOUND$1;
8245
8326
  }
8246
8327
  isUserInvalidError() {
8247
8328
  return ((this.errorData instanceof InvalidArgumentError &&
@@ -8423,11 +8504,17 @@ function ensureArgumentIsJSONString(argName, argValue, correlationId) {
8423
8504
  }
8424
8505
  throw e; // Rethrow unexpected errors
8425
8506
  }
8507
+ }
8508
+ function ensureArgumentIsStringArray(argName, argValue, correlationId) {
8509
+ if (!Array.isArray(argValue) ||
8510
+ !argValue.every((value) => typeof value === "string")) {
8511
+ throw new InvalidArgumentError(argName, correlationId);
8512
+ }
8426
8513
  }
8427
8514
 
8428
8515
  /* eslint-disable header/header */
8429
8516
  const name = "@azure/msal-browser";
8430
- const version = "5.25.1";
8517
+ const version = "5.27.0";
8431
8518
 
8432
8519
  /*
8433
8520
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8637,7 +8724,7 @@ class SignInError extends AuthActionErrorBase {
8637
8724
  * @returns true if the error is due to the user not being found, false otherwise.
8638
8725
  */
8639
8726
  isUserNotFound() {
8640
- return this.errorData.error === USER_NOT_FOUND;
8727
+ return this.errorData.error === USER_NOT_FOUND$1;
8641
8728
  }
8642
8729
  /**
8643
8730
  * Checks if the error is due to the username being invalid.
@@ -9873,9 +9960,14 @@ function parseAuthResponseFromUrl() {
9873
9960
  };
9874
9961
  }
9875
9962
  /**
9876
- * Clears hash from window url.
9963
+ * Clears a recognized authentication response fragment, preserving the query string.
9964
+ * Assigns an empty hash, then removes the trailing # when history updates are available.
9877
9965
  */
9878
9966
  function clearHash(contentWindow) {
9967
+ const serverParams = getDeserializedResponse(contentWindow.location.hash);
9968
+ if (!serverParams) {
9969
+ return;
9970
+ }
9879
9971
  // Office.js sets history.replaceState to null
9880
9972
  contentWindow.location.hash = "";
9881
9973
  if (typeof contentWindow.history.replaceState === "function") {
@@ -9883,6 +9975,16 @@ function clearHash(contentWindow) {
9883
9975
  contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
9884
9976
  }
9885
9977
  }
9978
+ /**
9979
+ * Strips both hash and query string from the given window's URL by replacing
9980
+ * with origin + pathname only. Used to remove auth response parameters
9981
+ * (auth code, state, etc.) before the window is closed or navigated away.
9982
+ */
9983
+ function clearAuthResponseFromUrl(contentWindow) {
9984
+ if (typeof contentWindow.history?.replaceState === "function") {
9985
+ contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}`);
9986
+ }
9987
+ }
9886
9988
  /**
9887
9989
  * Replaces current hash with hash from provided url
9888
9990
  */
@@ -11068,6 +11170,90 @@ function validateRequestMethod(interactionRequest, protocolMode) {
11068
11170
  return httpMethod;
11069
11171
  }
11070
11172
 
11173
+ /*
11174
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11175
+ * Licensed under the MIT License.
11176
+ */
11177
+ /**
11178
+ * `window.origin` of a document with an opaque origin, e.g. one sandboxed
11179
+ * without `allow-same-origin`. Read from `window.origin`, not
11180
+ * `location.origin`, which reports the real host even when sandboxed.
11181
+ */
11182
+ const OPAQUE_ORIGIN = "null";
11183
+ /**
11184
+ * Returns `true` when every ancestor browsing context is same-origin with
11185
+ * `win`. A top-level document has no ancestors, so it always passes.
11186
+ */
11187
+ function allAncestorsSameOrigin(win) {
11188
+ try {
11189
+ // Sandboxed: no origin to compare ancestors against.
11190
+ if (win.origin === OPAQUE_ORIGIN) {
11191
+ return false;
11192
+ }
11193
+ let current = win;
11194
+ // `window.parent` is self-referential at the top level, never falsy.
11195
+ while (current !== current.parent) {
11196
+ current = current.parent;
11197
+ // Throws SecurityError if this ancestor is cross-origin.
11198
+ void current.location.href;
11199
+ }
11200
+ return true;
11201
+ }
11202
+ catch {
11203
+ return false;
11204
+ }
11205
+ }
11206
+ /**
11207
+ * Returns `true` when the top-level window has no opener, or one that is
11208
+ * same-origin with it.
11209
+ *
11210
+ * Reads the opener from `win.top`, not `win`: a framed document always reports
11211
+ * `window.opener === null` and would pass while the top window's untrusted
11212
+ * opener still holds a handle on it.
11213
+ */
11214
+ function topOpenerIsSameOriginOrAbsent(win) {
11215
+ try {
11216
+ const top = win.top;
11217
+ if (!top) {
11218
+ // Detached from its browsing context; treat as unsafe.
11219
+ return false;
11220
+ }
11221
+ const opener = top.opener;
11222
+ if (!opener || opener === top) {
11223
+ return true;
11224
+ }
11225
+ // Throws SecurityError if the opener is cross-origin.
11226
+ void opener.location.href;
11227
+ return true;
11228
+ }
11229
+ catch {
11230
+ return false;
11231
+ }
11232
+ }
11233
+ /**
11234
+ * Computes the `pocd` ("popup origin check done") authorize parameter value.
11235
+ *
11236
+ * `1` means no untrusted window can reach the popup, which is what lets Entra
11237
+ * omit the `Cross-Origin-Opener-Policy` response header for the request.
11238
+ *
11239
+ * @param config Resolved browser configuration.
11240
+ * @param win Window whose hosting environment is being checked. Defaults to the app window.
11241
+ * @returns `1` when the check passes, otherwise `0`.
11242
+ */
11243
+ function computePocd(config, win = typeof window !== "undefined" ? window : undefined) {
11244
+ /*
11245
+ * Only an explicit false opts out; anything else computes the check, so an
11246
+ * unresolved config fails closed rather than asserting pocd=1.
11247
+ */
11248
+ if (config.auth.originCheck === false) {
11249
+ return 1;
11250
+ }
11251
+ if (!win || !allAncestorsSameOrigin(win)) {
11252
+ return 0;
11253
+ }
11254
+ return topOpenerIsSameOriginOrAbsent(win) ? 1 : 0;
11255
+ }
11256
+
11071
11257
  /*
11072
11258
  * Copyright (c) Microsoft Corporation. All rights reserved.
11073
11259
  * Licensed under the MIT License.
@@ -11085,6 +11271,11 @@ class StandardInteractionClient extends BaseInteractionClient {
11085
11271
  const validLogoutRequest = {
11086
11272
  correlationId: this.correlationId,
11087
11273
  ...logoutRequest,
11274
+ /*
11275
+ * Computed here rather than per flow so every end-session request
11276
+ * carries it, matching the authorize path.
11277
+ */
11278
+ popupOriginCheckDone: computePocd(this.config) === 1,
11088
11279
  };
11089
11280
  /**
11090
11281
  * Set logout_hint to be login_hint from ID Token Claims if present
@@ -12145,7 +12336,7 @@ function filterCustomHeaders(headers, logger, correlationId) {
12145
12336
  * Licensed under the MIT License.
12146
12337
  */
12147
12338
  const HTTP_REQUEST_FAILED = "http_request_failed";
12148
- const REDIRECT_TO_WEB = "redirect_to_web";
12339
+ const WEB_REDIRECT_REQUIRED = "web_redirect_required";
12149
12340
  const UNEXPECTED_ERROR = "unexpected_error";
12150
12341
  const AUTH_CODE_MISSING = "authorization_code_missing";
12151
12342
  const INVALID_TOKEN_RESPONSE = "invalid_token_response";
@@ -12197,6 +12388,7 @@ function normalizeOAuthError(response) {
12197
12388
  code: readString(response.error) ?? UNEXPECTED_ERROR,
12198
12389
  message: readString(response.error_description),
12199
12390
  errorCodes: readNumberArray(response.error_codes),
12391
+ subError: readString(response.suberror),
12200
12392
  correlationId: readString(response.correlation_id),
12201
12393
  traceId: readString(response.trace_id),
12202
12394
  timestamp: readString(response.timestamp),
@@ -12212,32 +12404,6 @@ function readNumberArray(value) {
12212
12404
  return undefined;
12213
12405
  }
12214
12406
 
12215
- /*
12216
- * Copyright (c) Microsoft Corporation. All rights reserved.
12217
- * Licensed under the MIT License.
12218
- */
12219
- // Content type used by V2 JSON `/api` requests.
12220
- const JSON_CONTENT_TYPE = "application/json";
12221
- // Server action returned after successful credential verification.
12222
- const UPDATE_RELATION = "update";
12223
- const CHALLENGE_RELATION = "challenge";
12224
- const VERIFY_RELATION = "verify";
12225
- const RISK_VERIFY_RELATION = "riskverify";
12226
- const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
12227
- const AuthenticationMethodTypeV2 = {
12228
- EMAIL: "email",
12229
- PASSWORD: "password",
12230
- SMS: "sms",
12231
- };
12232
- /*
12233
- * Known `state` values on a HAL response. Kept open (the body field is typed as string) because
12234
- * the server may introduce new values; response parsing and flow logic branch on these constants.
12235
- */
12236
- const ResponseStateV2 = {
12237
- CONTINUE: "continue",
12238
- WEB_FALLBACK_REQUIRED: "webFallbackRequired",
12239
- };
12240
-
12241
12407
  /*
12242
12408
  * Copyright (c) Microsoft Corporation. All rights reserved.
12243
12409
  * Licensed under the MIT License.
@@ -12258,17 +12424,14 @@ class ResponseHandlerV2 {
12258
12424
  const correlationId = response.headers.get(HttpHeaderKeys.X_MS_REQUEST_ID) ??
12259
12425
  requestCorrelationId;
12260
12426
  const json = await this.parseBody(response, correlationId);
12261
- const state = typeof json.state === "string" ? json.state : undefined;
12262
12427
  const continuationToken = (typeof json.continuationToken === "string"
12263
12428
  ? json.continuationToken
12264
12429
  : undefined) ??
12265
12430
  (typeof json.continuation_token === "string"
12266
12431
  ? json.continuation_token
12267
12432
  : undefined);
12268
- const flatError = typeof json.error === "string" ? json.error : undefined;
12269
- const isWebFallbackRequired = flatError === REDIRECT_TO_WEB ||
12270
- state === ResponseStateV2.WEB_FALLBACK_REQUIRED;
12271
12433
  const error = normalizeServerErrorV2(json);
12434
+ const isWebFallbackRequired = error?.subError === WEB_REDIRECT_REQUIRED;
12272
12435
  // Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
12273
12436
  json.correlationId = correlationId;
12274
12437
  return {
@@ -12384,6 +12547,31 @@ function apiPath(path) {
12384
12547
  return path.startsWith("/") ? path : `/${path}`;
12385
12548
  }
12386
12549
 
12550
+ /*
12551
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12552
+ * Licensed under the MIT License.
12553
+ */
12554
+ // Content type used by V2 JSON `/api` requests.
12555
+ const JSON_CONTENT_TYPE = "application/json";
12556
+ // Server action returned after successful credential verification.
12557
+ const UPDATE_RELATION = "update";
12558
+ const CHALLENGE_RELATION = "challenge";
12559
+ const VERIFY_RELATION = "verify";
12560
+ const RISK_VERIFY_RELATION = "riskverify";
12561
+ const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
12562
+ const AuthenticationMethodTypeV2 = {
12563
+ EMAIL: "email",
12564
+ PASSWORD: "password",
12565
+ SMS: "sms",
12566
+ };
12567
+ /*
12568
+ * Known `state` values on a HAL response. Kept open (the body field is typed as string) because
12569
+ * the server may introduce new values; response parsing and flow logic branch on these constants.
12570
+ */
12571
+ const ResponseStateV2 = {
12572
+ CONTINUE: "continue",
12573
+ };
12574
+
12387
12575
  /*
12388
12576
  * Copyright (c) Microsoft Corporation. All rights reserved.
12389
12577
  * Licensed under the MIT License.
@@ -12426,13 +12614,16 @@ class BaseApiClientV2 {
12426
12614
  /*
12427
12615
  * Starts authorization and returns the initial continuation token and flow links.
12428
12616
  */
12429
- async authorizeChallengeStart(context, scopes) {
12617
+ async authorizeChallengeStart(context, scopes, claims) {
12430
12618
  const request = {
12431
12619
  client_id: this.clientId,
12432
12620
  };
12433
12621
  if (scopes?.length) {
12434
12622
  request.scope = scopes.join(" ");
12435
12623
  }
12624
+ if (claims) {
12625
+ request.claims = claims;
12626
+ }
12436
12627
  const parsedResponse = await this.postOAuthForm(AUTHORIZE_CHALLENGE, request, context);
12437
12628
  const { continuationToken, correlationId, error, body } = parsedResponse;
12438
12629
  /*
@@ -12459,7 +12650,7 @@ class BaseApiClientV2 {
12459
12650
  */
12460
12651
  async completeWithTokens(request, context) {
12461
12652
  const code = await this.authorizeChallengeContinue(request.continuationToken, context);
12462
- return this.token(code, request.scopes, context);
12653
+ return this.token(code, context);
12463
12654
  }
12464
12655
  /*
12465
12656
  * Redeems a continuation token for an authorization code.
@@ -12480,7 +12671,7 @@ class BaseApiClientV2 {
12480
12671
  /*
12481
12672
  * Exchanges an authorization code for tokens.
12482
12673
  */
12483
- async token(code, scopes, context) {
12674
+ async token(code, context) {
12484
12675
  const request = {
12485
12676
  client_id: this.clientId,
12486
12677
  grant_type: GrantType$1.AUTHORIZATION_CODE_GRANT,
@@ -12488,9 +12679,6 @@ class BaseApiClientV2 {
12488
12679
  // Required so the server returns the client_info blob MSAL uses to build the home account id.
12489
12680
  client_info: "1",
12490
12681
  };
12491
- if (scopes.length > 0) {
12492
- request.scope = scopes.join(" ");
12493
- }
12494
12682
  const parsedResponse = await this.postOAuthForm(SIGNIN_TOKEN, request, context);
12495
12683
  this.throwOnApiError(parsedResponse);
12496
12684
  this.ensureTokenResponseIsValid(parsedResponse.body, parsedResponse.correlationId);
@@ -12543,11 +12731,13 @@ class BaseApiClientV2 {
12543
12731
  }
12544
12732
  }
12545
12733
  toApiError(serverError, correlationId) {
12546
- return new CustomAuthApiError(serverError.code, serverError.message ?? "", serverError.correlationId ?? correlationId, serverError.errorCodes, serverError.innerErrorCode, undefined, undefined, serverError.traceId, serverError.timestamp, serverError.attributeValidationDetails);
12734
+ return new CustomAuthApiError(serverError.code, serverError.message ?? "", serverError.correlationId ?? correlationId, serverError.errorCodes, serverError.subError, undefined, undefined, serverError.traceId, serverError.timestamp, serverError.attributeValidationDetails, serverError.innerErrorCode);
12547
12735
  }
12548
12736
  throwOnWebFallback(parsedResponse) {
12549
12737
  if (parsedResponse.isWebFallbackRequired) {
12550
- throw new CustomAuthApiError(REDIRECT_TO_WEB, "The server requires the flow to continue in a web browser", parsedResponse.correlationId);
12738
+ if (parsedResponse.error?.subError === WEB_REDIRECT_REQUIRED) {
12739
+ throw this.toApiError(parsedResponse.error, parsedResponse.correlationId);
12740
+ }
12551
12741
  }
12552
12742
  }
12553
12743
  ensureTokenResponseIsValid(tokenResponse, correlationId) {
@@ -12875,13 +13065,16 @@ class InteractionClientBaseV2 extends StandardInteractionClient {
12875
13065
  ...defaultScopes.filter((scope) => !seenScopes.has(scope.toLowerCase())),
12876
13066
  ];
12877
13067
  }
12878
- async handleTokenResponse(tokenResponse, requestScopes, correlationId, apiId) {
13068
+ async handleTokenResponse(tokenResponse, requestedScopes, correlationId, apiId) {
12879
13069
  this.logger.verbose("1aahxi", correlationId);
12880
13070
  const requestTimestamp = Math.round(new Date().getTime() / 1000.0);
13071
+ const responseScopes = tokenResponse.scope
13072
+ ? tokenResponse.scope.split(" ").filter((scope) => !!scope)
13073
+ : requestedScopes;
12881
13074
  const result = await this.tokenResponseHandler.handleServerTokenResponse(tokenResponse, this.customAuthAuthority, requestTimestamp, {
12882
13075
  authority: this.customAuthAuthority.canonicalAuthority,
12883
13076
  correlationId,
12884
- scopes: requestScopes,
13077
+ scopes: responseScopes,
12885
13078
  }, apiId);
12886
13079
  return result;
12887
13080
  }
@@ -13005,13 +13198,15 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13005
13198
  this.apiClient = apiClient;
13006
13199
  }
13007
13200
  /*
13008
- * Starts sign-in using the preferred supported method offered by the server.
13201
+ * Starts sign-in by automatically using a sole supported method or returning
13202
+ * multiple supported methods for user selection.
13009
13203
  */
13010
13204
  async signIn(parameters) {
13011
13205
  const correlationId = parameters.correlationId;
13012
13206
  const context = this.createRequestContext(SIGN_IN_V2_START, correlationId);
13013
13207
  this.logger.verbose("1jeyrn", correlationId);
13014
- const entryResult = await this.apiClient.authorizeChallengeStart(context);
13208
+ const scopes = this.getScopes(parameters.scopes);
13209
+ const entryResult = await this.apiClient.authorizeChallengeStart(context, scopes, parameters.claims);
13015
13210
  const startResult = await this.apiClient.signInStart(this.requireLink(correlationId, entryResult.signInHref, {
13016
13211
  code: SIGN_IN_UNSUPPORTED,
13017
13212
  message: "The authorize-challenge entry response did not include a sign-in link.",
@@ -13023,10 +13218,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13023
13218
  const continuationState = {
13024
13219
  continuationToken: startResult.continuationToken,
13025
13220
  scenario: CustomAuthFlowScenarioV2.SignIn,
13221
+ scopes,
13026
13222
  links: {},
13027
- tokenRequest: {
13028
- scopes: parameters.scopes,
13029
- },
13030
13223
  };
13031
13224
  const methods = startResult.methods.map((method) => ({
13032
13225
  id: method.id,
@@ -13034,7 +13227,15 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13034
13227
  hint: method.hint,
13035
13228
  challengeHref: method.challengeHref,
13036
13229
  }));
13037
- const selectedMethod = this.selectSignInMethod(methods, parameters.password !== undefined, correlationId);
13230
+ const supportedMethods = this.getSupportedSignInMethods(methods, correlationId);
13231
+ if (supportedMethods.length > 1) {
13232
+ return createFlowMethodSelectionRequiredResultV2({
13233
+ correlationId,
13234
+ continuationState,
13235
+ methods: supportedMethods,
13236
+ });
13237
+ }
13238
+ const selectedMethod = supportedMethods[0];
13038
13239
  const challengeResult = await this.requestChallenge({
13039
13240
  correlationId,
13040
13241
  continuationState: {
@@ -13067,7 +13268,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13067
13268
  const correlationId = parameters.correlationId;
13068
13269
  const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
13069
13270
  this.logger.verbose("19e1ak", correlationId);
13070
- const entryResult = await this.apiClient.authorizeChallengeStart(context, parameters.scopes);
13271
+ const scopes = this.getScopes(parameters.scopes);
13272
+ const entryResult = await this.apiClient.authorizeChallengeStart(context, scopes, parameters.claims);
13071
13273
  const startResult = await this.apiClient.signUpStart(this.requireLink(correlationId, entryResult.signUpHref, {
13072
13274
  code: SIGN_UP_UNSUPPORTED,
13073
13275
  message: "The authorize-challenge entry response did not include a sign-up link.",
@@ -13087,10 +13289,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13087
13289
  const continuationState = {
13088
13290
  continuationToken: startResult.continuationToken,
13089
13291
  scenario: CustomAuthFlowScenarioV2.SignUp,
13292
+ scopes,
13090
13293
  links: {},
13091
- tokenRequest: {
13092
- scopes: parameters.scopes,
13093
- },
13094
13294
  signUp: {
13095
13295
  passwordWasSupplied: attributes.password !== undefined,
13096
13296
  },
@@ -13111,7 +13311,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13111
13311
  const correlationId = parameters.correlationId;
13112
13312
  const context = this.createRequestContext(RESET_PASSWORD_V2_START, correlationId);
13113
13313
  this.logger.verbose("1en88i", correlationId);
13114
- const entryResult = await this.apiClient.authorizeChallengeStart(context);
13314
+ const scopes = this.getScopes(parameters.scopes);
13315
+ const entryResult = await this.apiClient.authorizeChallengeStart(context, scopes, parameters.claims);
13115
13316
  const startResult = await this.apiClient.resetPasswordStart(this.requireLink(correlationId, entryResult.resetPasswordHref, {
13116
13317
  code: RESET_PASSWORD_UNSUPPORTED,
13117
13318
  message: "The authorize-challenge entry response did not include a reset-password link.",
@@ -13123,6 +13324,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13123
13324
  const continuationState = {
13124
13325
  continuationToken: startResult.continuationToken,
13125
13326
  scenario: CustomAuthFlowScenarioV2.PasswordReset,
13327
+ scopes,
13126
13328
  links: {},
13127
13329
  };
13128
13330
  const methods = startResult.methods.map((method) => ({
@@ -13177,21 +13379,30 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13177
13379
  */
13178
13380
  async requestChallenge(parameters) {
13179
13381
  const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
13180
- const challengeType = challengeResult.type ?? AuthenticationMethodTypeV2.EMAIL;
13382
+ const challengeType = challengeResult.type;
13383
+ const normalizedChallengeType = challengeType?.toLowerCase();
13181
13384
  const continuationState = this.createChallengeContinuationState(parameters.continuationState, challengeResult);
13182
- if (challengeType.toLowerCase() === AuthenticationMethodTypeV2.PASSWORD) {
13385
+ if (normalizedChallengeType === AuthenticationMethodTypeV2.PASSWORD) {
13183
13386
  return createFlowPasswordRequiredResultV2({
13184
13387
  correlationId: parameters.correlationId,
13185
13388
  continuationState,
13186
13389
  });
13187
13390
  }
13188
- return createFlowCodeRequiredResultV2({
13189
- correlationId: parameters.correlationId,
13190
- continuationState,
13191
- channel: challengeType,
13192
- sentTo: challengeResult.hint,
13193
- codeLength: challengeResult.codeLength,
13194
- });
13391
+ if (normalizedChallengeType === AuthenticationMethodTypeV2.EMAIL ||
13392
+ normalizedChallengeType === AuthenticationMethodTypeV2.SMS) {
13393
+ return createFlowCodeRequiredResultV2({
13394
+ correlationId: parameters.correlationId,
13395
+ continuationState,
13396
+ channel: challengeType,
13397
+ sentTo: challengeResult.hint,
13398
+ codeLength: challengeResult.codeLength,
13399
+ });
13400
+ }
13401
+ const message = challengeType
13402
+ ? `Challenge type '${challengeType}' is not supported.`
13403
+ : "Challenge type is missing.";
13404
+ this.logger.error(message, parameters.correlationId);
13405
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13195
13406
  }
13196
13407
  /*
13197
13408
  * Verifies the submitted one-time code using the server-provided link. The
@@ -13216,6 +13427,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13216
13427
  continuationState: {
13217
13428
  continuationToken: verifyResult.continuationToken,
13218
13429
  scenario: continuationState.scenario,
13430
+ scopes: continuationState.scopes,
13219
13431
  links: { update: verifyResult.updateHref },
13220
13432
  },
13221
13433
  });
@@ -13230,10 +13442,10 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13230
13442
  const nextContinuationState = {
13231
13443
  continuationToken: verifyResult.continuationToken,
13232
13444
  scenario: continuationState.scenario,
13445
+ scopes: continuationState.scopes,
13233
13446
  links: {
13234
13447
  submitAttributes: verifyResult.submitAttributesHref,
13235
13448
  },
13236
- tokenRequest: continuationState.tokenRequest,
13237
13449
  signUp: continuationState.signUp,
13238
13450
  };
13239
13451
  const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
@@ -13259,8 +13471,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13259
13471
  continuationState: {
13260
13472
  continuationToken: verifyResult.continuationToken,
13261
13473
  scenario: continuationState.scenario,
13474
+ scopes: continuationState.scopes,
13262
13475
  links: {},
13263
- tokenRequest: continuationState.tokenRequest,
13264
13476
  },
13265
13477
  });
13266
13478
  }
@@ -13337,6 +13549,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13337
13549
  continuationState: {
13338
13550
  continuationToken: completionToken,
13339
13551
  scenario: continuationState.scenario,
13552
+ scopes: continuationState.scopes,
13340
13553
  links: {},
13341
13554
  },
13342
13555
  });
@@ -13358,12 +13571,10 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13358
13571
  const apiId = this.resolveStepApiId(continuationState.scenario, "signInWithContinuation", correlationId);
13359
13572
  const context = this.createRequestContext(apiId, correlationId);
13360
13573
  this.logger.verbose("09mk3f", correlationId);
13361
- const scopes = this.getScopes(parameters.scopes);
13362
13574
  const tokenResponse = await this.apiClient.completeWithTokens({
13363
13575
  continuationToken: continuationState.continuationToken,
13364
- scopes,
13365
13576
  }, context);
13366
- const authenticationResult = await this.handleTokenResponse(tokenResponse, scopes, correlationId, apiId);
13577
+ const authenticationResult = await this.handleTokenResponse(tokenResponse, continuationState.scopes, correlationId, apiId);
13367
13578
  this.logger.verbose("15nu4j", correlationId);
13368
13579
  return createFlowCompletedResultV2({
13369
13580
  correlationId,
@@ -13378,8 +13589,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13378
13589
  continuationState: {
13379
13590
  continuationToken: verifyResult.continuationToken,
13380
13591
  scenario: continuationState.scenario,
13592
+ scopes: continuationState.scopes,
13381
13593
  links: {},
13382
- tokenRequest: continuationState.tokenRequest,
13383
13594
  },
13384
13595
  methods: verifyResult.methods.map((method) => ({
13385
13596
  id: method.id,
@@ -13396,23 +13607,17 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13396
13607
  this.logger.error(message, correlationId);
13397
13608
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13398
13609
  }
13399
- selectSignInMethod(methods, passwordProvided, correlationId) {
13400
- const passwordMethod = methods.find((method) => method.type.toLowerCase() ===
13401
- AuthenticationMethodTypeV2.PASSWORD);
13402
- const emailMethod = methods.find((method) => method.type.toLowerCase() === AuthenticationMethodTypeV2.EMAIL);
13403
- if (passwordProvided) {
13404
- if (passwordMethod) {
13405
- return passwordMethod;
13406
- }
13407
- const message = "A password was supplied, but the sign-in response did not include a password method.";
13408
- this.logger.error(message, correlationId);
13409
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13410
- }
13411
- const selectedMethod = emailMethod ?? passwordMethod;
13412
- if (selectedMethod) {
13413
- return selectedMethod;
13610
+ getSupportedSignInMethods(methods, correlationId) {
13611
+ const supportedMethods = methods.filter((method) => {
13612
+ const methodType = method.type.toLowerCase();
13613
+ return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13614
+ methodType === AuthenticationMethodTypeV2.PASSWORD ||
13615
+ methodType === AuthenticationMethodTypeV2.SMS);
13616
+ });
13617
+ if (supportedMethods.length > 0) {
13618
+ return supportedMethods;
13414
13619
  }
13415
- const message = "The sign-in start response did not include a supported email or password method.";
13620
+ const message = "The sign-in start response did not include a supported email, SMS, or password method.";
13416
13621
  this.logger.error(message, correlationId);
13417
13622
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13418
13623
  }
@@ -13424,11 +13629,11 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13424
13629
  continuationState: {
13425
13630
  continuationToken: result.continuationToken,
13426
13631
  scenario: continuationState.scenario,
13632
+ scopes: continuationState.scopes,
13427
13633
  links: {
13428
13634
  verify: result.verifyHref,
13429
13635
  resend: result.resendHref,
13430
13636
  },
13431
- tokenRequest: continuationState.tokenRequest,
13432
13637
  signUp: continuationState.signUp,
13433
13638
  },
13434
13639
  channel: result.type,
@@ -13443,10 +13648,10 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13443
13648
  const nextContinuationState = {
13444
13649
  continuationToken: result.continuationToken,
13445
13650
  scenario: continuationState.scenario,
13651
+ scopes: continuationState.scopes,
13446
13652
  links: {
13447
13653
  submitAttributes: result.submitAttributesHref,
13448
13654
  },
13449
- tokenRequest: continuationState.tokenRequest,
13450
13655
  signUp: continuationState.signUp,
13451
13656
  };
13452
13657
  const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
@@ -13471,8 +13676,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13471
13676
  continuationState: {
13472
13677
  continuationToken: result.continuationToken,
13473
13678
  scenario: continuationState.scenario,
13679
+ scopes: continuationState.scopes,
13474
13680
  links: {},
13475
- tokenRequest: continuationState.tokenRequest,
13476
13681
  },
13477
13682
  });
13478
13683
  }
@@ -13503,10 +13708,9 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13503
13708
  continuationState: {
13504
13709
  continuationToken,
13505
13710
  scenario: continuationState.scenario,
13711
+ scopes: continuationState.scopes,
13506
13712
  links: {},
13507
- tokenRequest: continuationState.tokenRequest,
13508
13713
  },
13509
- scopes: continuationState.tokenRequest?.scopes,
13510
13714
  });
13511
13715
  }
13512
13716
  async sendMethodChallenge(parameters, step) {
@@ -13535,15 +13739,13 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13535
13739
  return {
13536
13740
  continuationToken: challengeResult.continuationToken,
13537
13741
  scenario: continuationState.scenario,
13742
+ scopes: continuationState.scopes,
13538
13743
  links: {
13539
13744
  challenge: continuationState.links.challenge,
13540
13745
  verify: challengeResult.verifyHref,
13541
13746
  resend: challengeResult.resendHref ??
13542
13747
  continuationState.links.resend,
13543
13748
  },
13544
- ...(continuationState.tokenRequest && {
13545
- tokenRequest: continuationState.tokenRequest,
13546
- }),
13547
13749
  ...(continuationState.signUp && {
13548
13750
  signUp: continuationState.signUp,
13549
13751
  }),
@@ -13586,93 +13788,24 @@ class FailedStateV2 extends AuthFlowStateBase {
13586
13788
  }
13587
13789
  }
13588
13790
 
13589
- /*
13590
- * Copyright (c) Microsoft Corporation. All rights reserved.
13591
- * Licensed under the MIT License.
13592
- */
13593
- /**
13594
- * Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
13595
- * to narrow the state before accessing its members.
13596
- */
13597
- class CustomAuthResultV2 {
13598
- constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
13599
- this.state = state;
13600
- this.data = data;
13601
- this.scenario = scenario;
13602
- }
13603
- /**
13604
- * Narrows the result to a specific state by its `stateType` discriminator.
13605
- * A successful match makes the state's properties available without a cast.
13606
- * @param stateType - The state type to test for.
13607
- * @returns True (and narrows `state`) when the current state matches `stateType`.
13608
- */
13609
- isState(stateType) {
13610
- return this.state.stateType === stateType;
13611
- }
13612
- /**
13613
- * Checks whether the result is in the terminal failed state. A failed result
13614
- * contains the flow-specific error.
13615
- * @returns True (and narrows `state`) when the operation failed.
13616
- */
13617
- isFailed() {
13618
- return this.state.stateType === "failed";
13619
- }
13620
- /**
13621
- * Creates a failed result from the supplied error. The result uses the
13622
- * shared {@link FailedStateV2} terminal state.
13623
- * @param error - The error that occurred.
13624
- * @param options - The flow-error type and error context.
13625
- * @returns A failed result carrying the flow-specific error.
13626
- */
13627
- static createWithError(error, options) {
13628
- const { errorType: ErrorType, scenario = CustomAuthFlowScenarioV2.Unknown, correlationId, } = options;
13629
- const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
13630
- const flowError = new ErrorType(errorData, scenario);
13631
- const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
13632
- result.error = flowError;
13633
- return result;
13634
- }
13635
- static createErrorData(error, correlationId) {
13636
- if (error instanceof CustomAuthError) {
13637
- return error;
13638
- }
13639
- if (error instanceof AuthError) {
13640
- const errorCodes = [];
13641
- if ("errorNo" in error) {
13642
- if (typeof error.errorNo === "string") {
13643
- const code = Number(error.errorNo);
13644
- if (!isNaN(code)) {
13645
- errorCodes.push(code);
13646
- }
13647
- }
13648
- else if (typeof error.errorNo === "number") {
13649
- errorCodes.push(error.errorNo);
13650
- }
13651
- }
13652
- return new MsalCustomAuthError(error.errorCode, error.errorMessage, error.subError, errorCodes, error.correlationId);
13653
- }
13654
- return new UnexpectedError(error, correlationId);
13655
- }
13656
- }
13657
-
13658
13791
  /*
13659
13792
  * Copyright (c) Microsoft Corporation. All rights reserved.
13660
13793
  * Licensed under the MIT License.
13661
13794
  */
13662
13795
  const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
13663
13796
  const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
13664
- const PASSWORD_TOO_WEAK = "passwordTooWeak";
13797
+ const PASSWORD_TOO_WEAK = "passwordTooWeak";
13798
+ const USER_NOT_FOUND = "userNotFound";
13665
13799
 
13666
13800
  /*
13667
13801
  * Copyright (c) Microsoft Corporation. All rights reserved.
13668
13802
  * Licensed under the MIT License.
13669
13803
  */
13670
- /*
13671
- * Standalone V2 error base; intentionally does NOT extend the V1 AuthFlowErrorBase.
13672
- * Provides the detectors common to every V2 flow; each per-action subclass adds only
13673
- * the detectors relevant to its own action.
13804
+ /**
13805
+ * Error returned by a native authentication V2 operation. Use its classifiers
13806
+ * to handle known failures while retaining raw diagnostics through `errorData`.
13674
13807
  */
13675
- class AuthFlowErrorBaseV2 {
13808
+ class AuthFlowErrorV2 {
13676
13809
  constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
13677
13810
  this.errorData = errorData;
13678
13811
  this.scenario = scenario;
@@ -13686,18 +13819,36 @@ class AuthFlowErrorBaseV2 {
13686
13819
  get errorDescription() {
13687
13820
  return this.errorData.errorDescription;
13688
13821
  }
13822
+ get innerErrorCode() {
13823
+ return this.errorData instanceof CustomAuthApiError
13824
+ ? this.errorData.innerErrorCode
13825
+ : undefined;
13826
+ }
13689
13827
  /**
13690
- * Checks if the error requires the flow to continue in the browser. The
13691
- * server surfaces this as a `redirect_to_web` failure, so a browser hand-off
13692
- * always arrives as a `FailedStateV2` on which this detector returns true.
13693
- * @returns True if the browser is required, false otherwise.
13828
+ * Gets the attribute ids that the service reports as required.
13694
13829
  */
13695
- isBrowserRequired() {
13696
- return this.errorData.error === REDIRECT_TO_WEB;
13830
+ get requiredAttributes() {
13831
+ return this.getAttributeIdsByCode("attributeRequired");
13697
13832
  }
13698
13833
  /**
13699
- * Checks if the error is due to a caller-supplied argument failing
13700
- * client-side validation before the request was issued (for example an empty
13834
+ * Gets the attribute ids whose submitted values failed validation.
13835
+ */
13836
+ get invalidAttributes() {
13837
+ return this.getAttributeIdsByCode("attributeValidationFailed");
13838
+ }
13839
+ /**
13840
+ * Checks if the error requires the flow to continue in the browser. The
13841
+ * server surfaces this as the `web_redirect_required` OAuth suberror, so a
13842
+ * browser hand-off arrives as a `FailedStateV2` on which this detector
13843
+ * returns true.
13844
+ * @returns True if the browser is required, false otherwise.
13845
+ */
13846
+ isBrowserRequired() {
13847
+ return this.errorData.subError === WEB_REDIRECT_REQUIRED;
13848
+ }
13849
+ /**
13850
+ * Checks if the error is due to a caller-supplied argument failing
13851
+ * client-side validation before the request was issued (for example an empty
13701
13852
  * username, code, or password, or an unknown method id). Use it to prompt the
13702
13853
  * user to correct the input rather than treating it as a server failure.
13703
13854
  * @returns True if the input was invalid, false otherwise.
@@ -13705,6 +13856,47 @@ class AuthFlowErrorBaseV2 {
13705
13856
  isInvalidInput() {
13706
13857
  return this.errorData instanceof InvalidArgumentError;
13707
13858
  }
13859
+ /**
13860
+ * Checks whether the service rejected the username parameter. Use it to ask
13861
+ * the user to correct the supplied username.
13862
+ * @returns True when the username is invalid, otherwise false.
13863
+ */
13864
+ isInvalidUsername() {
13865
+ return this.isUserInvalidError();
13866
+ }
13867
+ /**
13868
+ * Checks whether the supplied username does not identify an account. Use it
13869
+ * to distinguish a missing account from other request failures.
13870
+ * @returns True when the service reports that the user was not found.
13871
+ */
13872
+ isUserNotFound() {
13873
+ return this.isUserNotFoundError();
13874
+ }
13875
+ /**
13876
+ * Checks whether the service rejected the supplied sign-in credentials. This
13877
+ * classifier does not identify new-password policy failures.
13878
+ * @returns True when the username or password is incorrect.
13879
+ */
13880
+ isInvalidCredentials() {
13881
+ return this.isPasswordIncorrectError();
13882
+ }
13883
+ /**
13884
+ * Checks whether the service rejected a one-time code. Use it to prompt the
13885
+ * user to re-enter the code or request a new one.
13886
+ * @returns True when the one-time code is invalid, otherwise false.
13887
+ */
13888
+ isInvalidCode() {
13889
+ return this.isInvalidCodeError();
13890
+ }
13891
+ /**
13892
+ * Checks whether a new password violates password policy. It recognizes
13893
+ * both weak-password responses and password-targeted validation details.
13894
+ * @returns True when the new password is invalid, otherwise false.
13895
+ */
13896
+ isInvalidPassword() {
13897
+ return (this.isInvalidPasswordError() ||
13898
+ this.isPasswordPolicyViolationError());
13899
+ }
13708
13900
  /**
13709
13901
  * Checks whether an account already exists for the supplied identifier.
13710
13902
  * This can occur at different stages while completing sign-up.
@@ -13713,15 +13905,19 @@ class AuthFlowErrorBaseV2 {
13713
13905
  isUserAlreadyExists() {
13714
13906
  return this.getAttributeValidationDetails().some((detail) => detail.code === "userAlreadyExists");
13715
13907
  }
13716
- /*
13717
- * User-not-found arrives as AADSTS50034. The nested `/api` error carries no
13718
- * innerError and no error_codes array, so the AADSTS marker in the message is
13719
- * the only signal.
13908
+ /**
13909
+ * Checks whether the service requires attributes omitted from the request.
13910
+ * Use it to collect the required attributes before resubmitting.
13911
+ * @returns True when required attributes are missing, otherwise false.
13720
13912
  */
13721
- // TODO: Use the service-provided suberror when it becomes available.
13913
+ isMissingRequiredAttributes() {
13914
+ return this.requiredAttributes.length > 0;
13915
+ }
13722
13916
  isUserNotFoundError() {
13723
13917
  return (this.errorData.error === "invalidRequest" &&
13724
- this.errorData.errorDescription?.includes("AADSTS50034") === true);
13918
+ (this.innerErrorCode === USER_NOT_FOUND ||
13919
+ this.errorData.errorDescription?.includes("AADSTS50034") ===
13920
+ true));
13725
13921
  }
13726
13922
  isUserInvalidError() {
13727
13923
  return (this.errorData.error === "invalidRequest" &&
@@ -13730,23 +13926,26 @@ class AuthFlowErrorBaseV2 {
13730
13926
  .toLowerCase()
13731
13927
  .includes("username parameter"));
13732
13928
  }
13733
- // The verification endpoint uses this outer/inner code pair for an invalid one-time code.
13734
13929
  isInvalidCodeError() {
13735
13930
  return (this.errorData.error === "invalidGrant" &&
13736
- this.errorData.subError === INVALID_ONE_TIME_CODE);
13931
+ this.innerErrorCode === INVALID_ONE_TIME_CODE);
13737
13932
  }
13738
- // New password rejected by policy: inner `passwordTooWeak` (AADSTS120002).
13739
13933
  isInvalidPasswordError() {
13740
13934
  return (this.errorData.error === "invalidRequest" &&
13741
- this.errorData.subError === PASSWORD_TOO_WEAK);
13935
+ this.innerErrorCode === PASSWORD_TOO_WEAK);
13742
13936
  }
13743
13937
  isPasswordPolicyViolationError() {
13744
- return this.getAttributeValidationDetails().some((detail) => detail.code === "passwordPolicyViolation" &&
13745
- detail.attributeIds?.some((attributeId) => attributeId.toLowerCase() === "password") === true);
13938
+ return this.getAttributeValidationDetails().some((detail) => {
13939
+ const attributeIds = detail.attributeIds;
13940
+ return (detail.code === "passwordPolicyViolation" &&
13941
+ Array.isArray(attributeIds) &&
13942
+ attributeIds.some((attributeId) => typeof attributeId === "string" &&
13943
+ attributeId.toLowerCase() === "password"));
13944
+ });
13746
13945
  }
13747
13946
  isPasswordIncorrectError() {
13748
13947
  return (this.errorData.error === "invalidGrant" &&
13749
- this.errorData.subError === INVALID_USERNAME_OR_PASSWORD);
13948
+ this.innerErrorCode === INVALID_USERNAME_OR_PASSWORD);
13750
13949
  }
13751
13950
  getAttributeValidationDetails() {
13752
13951
  const details = this.errorData.attributeValidationDetails;
@@ -13754,6 +13953,12 @@ class AuthFlowErrorBaseV2 {
13754
13953
  ? details.filter((detail) => typeof detail === "object" && detail !== null)
13755
13954
  : [];
13756
13955
  }
13956
+ getAttributeIdsByCode(code) {
13957
+ const attributeIds = this.getAttributeValidationDetails().flatMap((detail) => detail.code === code && Array.isArray(detail.attributeIds)
13958
+ ? detail.attributeIds.filter((attributeId) => typeof attributeId === "string")
13959
+ : []);
13960
+ return [...new Set(attributeIds)];
13961
+ }
13757
13962
  }
13758
13963
 
13759
13964
  /*
@@ -13761,35 +13966,67 @@ class AuthFlowErrorBaseV2 {
13761
13966
  * Licensed under the MIT License.
13762
13967
  */
13763
13968
  /**
13764
- * Error raised when requesting (or resending) a challenge for a selected
13765
- * authentication method. It is a shared action error bound to the shared
13766
- * `RequestChallengeResultV2` and returned regardless of which entry flow reached
13767
- * it. It currently exposes no action-specific detectors — only the inherited
13768
- * `isBrowserRequired()`.
13769
- */
13770
- class RequestChallengeErrorV2 extends AuthFlowErrorBaseV2 {
13771
- }
13772
-
13773
- /*
13774
- * Copyright (c) Microsoft Corporation. All rights reserved.
13775
- * Licensed under the MIT License.
13776
- */
13777
- /**
13778
- * Error raised when verifying a challenge (submitting a one-time code). It
13779
- * exposes the detectors relevant to code verification so the app can respond to
13780
- * a rejected code specifically. Unrecognised failures carry no specific
13781
- * detector; inspect the error code (`unexpected_error` when the server gives
13782
- * none) and `errorDescription`.
13969
+ * Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
13970
+ * to narrow the state before accessing its members.
13783
13971
  */
13784
- class VerifyChallengeErrorV2 extends AuthFlowErrorBaseV2 {
13972
+ class CustomAuthResultV2 {
13973
+ constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
13974
+ this.state = state;
13975
+ this.data = data;
13976
+ this.scenario = scenario;
13977
+ }
13785
13978
  /**
13786
- * Checks if the error is due to the provided code being invalid or expired.
13787
- * Use it to prompt the user to re-enter the code or request a new one, rather
13788
- * than restarting the whole flow.
13789
- * @returns True if the code is invalid, false otherwise.
13979
+ * Narrows the result to a specific state by its `stateType` discriminator.
13980
+ * A successful match makes the state's properties available without a cast.
13981
+ * @param stateType - The state type to test for.
13982
+ * @returns True (and narrows `state`) when the current state matches `stateType`.
13790
13983
  */
13791
- isInvalidCode() {
13792
- return this.isInvalidCodeError();
13984
+ isState(stateType) {
13985
+ return this.state.stateType === stateType;
13986
+ }
13987
+ /**
13988
+ * Checks whether the result is in the terminal failed state. A failed result
13989
+ * contains the unified V2 flow error.
13990
+ * @returns True (and narrows `state`) when the operation failed.
13991
+ */
13992
+ isFailed() {
13993
+ return this.state.stateType === "failed";
13994
+ }
13995
+ /**
13996
+ * Creates a failed result from the supplied error. The result uses the
13997
+ * shared {@link FailedStateV2} terminal state and unified V2 flow error.
13998
+ * @param error - The error that occurred.
13999
+ * @param options - The flow-error context.
14000
+ * @returns A failed result carrying the unified V2 flow error.
14001
+ */
14002
+ static createWithError(error, options) {
14003
+ const { scenario = CustomAuthFlowScenarioV2.Unknown, correlationId } = options;
14004
+ const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
14005
+ const flowError = new AuthFlowErrorV2(errorData, scenario);
14006
+ const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
14007
+ result.error = flowError;
14008
+ return result;
14009
+ }
14010
+ static createErrorData(error, correlationId) {
14011
+ if (error instanceof CustomAuthError) {
14012
+ return error;
14013
+ }
14014
+ if (error instanceof AuthError) {
14015
+ const errorCodes = [];
14016
+ if ("errorNo" in error) {
14017
+ if (typeof error.errorNo === "string") {
14018
+ const code = Number(error.errorNo);
14019
+ if (!isNaN(code)) {
14020
+ errorCodes.push(code);
14021
+ }
14022
+ }
14023
+ else if (typeof error.errorNo === "number") {
14024
+ errorCodes.push(error.errorNo);
14025
+ }
14026
+ }
14027
+ return new MsalCustomAuthError(error.errorCode, error.errorMessage, error.subError, errorCodes, error.correlationId);
14028
+ }
14029
+ return new UnexpectedError(error, correlationId);
13793
14030
  }
13794
14031
  }
13795
14032
 
@@ -13810,18 +14047,6 @@ class CompletedStateV2 extends AuthFlowStateBase {
13810
14047
  }
13811
14048
  }
13812
14049
 
13813
- /*
13814
- * Copyright (c) Microsoft Corporation. All rights reserved.
13815
- * Licensed under the MIT License.
13816
- */
13817
- /**
13818
- * Error raised when redeeming a completed V2 flow's continuation for tokens.
13819
- * It adds no action-specific detectors beyond the inherited
13820
- * `isBrowserRequired()`; the app typically retries or starts sign-in explicitly.
13821
- */
13822
- class SignInContinuationErrorV2 extends AuthFlowErrorBaseV2 {
13823
- }
13824
-
13825
14050
  /*
13826
14051
  * Copyright (c) Microsoft Corporation. All rights reserved.
13827
14052
  * Licensed under the MIT License.
@@ -13838,25 +14063,17 @@ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
13838
14063
  }
13839
14064
  /**
13840
14065
  * Signs the user in using the continuation established by the completed V2
13841
- * flow. On success the returned result reaches the completed state
13842
- * carrying the signed-in account data; on failure the result's error reports
13843
- * why the follow-up sign-in could not complete.
13844
- * @param inputs - Optional scopes requested for the issued token. Claims
13845
- * are accepted for API alignment but are not sent until the V2 service
13846
- * supports them on authorize-challenge.
13847
- * @returns The result of signing in after the password reset.
13848
- */
13849
- async signIn(inputs) {
14066
+ * flow. The result either reaches the completed state with the signed-in
14067
+ * account data or reports why the follow-up sign-in could not complete.
14068
+ * @returns The result of completing the continuation sign-in.
14069
+ */
14070
+ async signIn() {
13850
14071
  const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
13851
14072
  try {
13852
- if (inputs?.claims) {
13853
- ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
13854
- }
13855
14073
  logger.verbose("09mk3f", correlationId);
13856
14074
  const result = await flowClient.signInWithContinuation({
13857
14075
  correlationId,
13858
14076
  continuationState,
13859
- scopes: inputs?.scopes,
13860
14077
  });
13861
14078
  const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
13862
14079
  return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
@@ -13864,7 +14081,6 @@ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
13864
14081
  catch (error) {
13865
14082
  logger.errorPii(`0zoo5u ${error}`, correlationId);
13866
14083
  return CustomAuthResultV2.createWithError(error, {
13867
- errorType: SignInContinuationErrorV2,
13868
14084
  scenario: continuationState.scenario,
13869
14085
  correlationId,
13870
14086
  });
@@ -13872,29 +14088,6 @@ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
13872
14088
  }
13873
14089
  }
13874
14090
 
13875
- /*
13876
- * Copyright (c) Microsoft Corporation. All rights reserved.
13877
- * Licensed under the MIT License.
13878
- */
13879
- /**
13880
- * Error raised when submitting a new password. It exposes the detectors relevant
13881
- * to password submission so the app can react to a rejected password
13882
- * specifically. Unrecognised failures carry no specific detector; inspect the
13883
- * error code (`unexpected_error` when the server gives none) and
13884
- * `errorDescription`.
13885
- */
13886
- class SubmitNewPasswordErrorV2 extends AuthFlowErrorBaseV2 {
13887
- /**
13888
- * Checks if the error is due to the new password being invalid, for example
13889
- * because it fails the tenant's complexity policy. Use it to prompt the user
13890
- * for a stronger password rather than restarting the reset flow.
13891
- * @returns True if the new password is invalid, false otherwise.
13892
- */
13893
- isInvalidPassword() {
13894
- return this.isInvalidPasswordError();
13895
- }
13896
- }
13897
-
13898
14091
  /*
13899
14092
  * Copyright (c) Microsoft Corporation. All rights reserved.
13900
14093
  * Licensed under the MIT License.
@@ -13937,7 +14130,6 @@ class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
13937
14130
  catch (error) {
13938
14131
  logger.errorPii(`03m081 ${error}`, correlationId);
13939
14132
  return CustomAuthResultV2.createWithError(error, {
13940
- errorType: SubmitNewPasswordErrorV2,
13941
14133
  scenario: continuationState.scenario,
13942
14134
  correlationId,
13943
14135
  });
@@ -13958,9 +14150,7 @@ class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
13958
14150
  this.codeLength = stateParameters.codeLength;
13959
14151
  }
13960
14152
  async submitCodeCore(code) {
13961
- if (this.codeLength) {
13962
- this.ensureCodeIsValid(code, this.codeLength);
13963
- }
14153
+ ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
13964
14154
  return this.stateParameters.flowClient.submitCode({
13965
14155
  correlationId: this.stateParameters.correlationId,
13966
14156
  continuationState: this.stateParameters.continuationState,
@@ -13975,157 +14165,6 @@ class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
13975
14165
  }
13976
14166
  }
13977
14167
 
13978
- /*
13979
- * Copyright (c) Microsoft Corporation. All rights reserved.
13980
- * Licensed under the MIT License.
13981
- */
13982
- /**
13983
- * State returned when sign-in requires verification of an email or SMS MFA
13984
- * challenge. It allows the app to submit the challenge or request a replacement.
13985
- */
13986
- class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
13987
- constructor() {
13988
- super(...arguments);
13989
- this.stateType = "mfaVerificationRequired";
13990
- }
13991
- /**
13992
- * Submits the email or SMS challenge as the second authentication factor.
13993
- * Successful verification completes sign-in.
13994
- * @param challenge - The challenge value to submit.
13995
- * @returns The result of submitting the MFA challenge.
13996
- */
13997
- async submitChallenge(challenge) {
13998
- const { correlationId, logger, continuationState } = this.stateParameters;
13999
- try {
14000
- logger.verbose("10k0lc", correlationId);
14001
- const result = await this.submitCodeCore(challenge);
14002
- if (result.type !== FLOW_COMPLETED_V2) {
14003
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
14004
- }
14005
- const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14006
- return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14007
- }
14008
- catch (error) {
14009
- logger.errorPii(`178w0g ${error}`, correlationId);
14010
- return CustomAuthResultV2.createWithError(error, {
14011
- errorType: VerifyChallengeErrorV2,
14012
- scenario: continuationState.scenario,
14013
- correlationId,
14014
- });
14015
- }
14016
- }
14017
- /**
14018
- * Requests a replacement challenge for the selected MFA method. The
14019
- * returned state contains the refreshed email or SMS challenge metadata.
14020
- * @returns The result of requesting a replacement MFA challenge.
14021
- */
14022
- async resendChallenge() {
14023
- const { correlationId, logger, continuationState } = this.stateParameters;
14024
- try {
14025
- logger.verbose("13st9u", correlationId);
14026
- const result = await this.resendCodeCore();
14027
- return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
14028
- correlationId: result.correlationId,
14029
- logger,
14030
- config: this.stateParameters.config,
14031
- flowClient: this.stateParameters.flowClient,
14032
- continuationState: result.continuationState,
14033
- cacheClient: this.stateParameters.cacheClient,
14034
- method: this.method,
14035
- sentTo: result.sentTo,
14036
- channel: result.channel,
14037
- codeLength: result.codeLength,
14038
- }), undefined, result.continuationState.scenario);
14039
- }
14040
- catch (error) {
14041
- logger.errorPii(`1qw1ey ${error}`, correlationId);
14042
- return CustomAuthResultV2.createWithError(error, {
14043
- errorType: RequestChallengeErrorV2,
14044
- scenario: continuationState.scenario,
14045
- correlationId,
14046
- });
14047
- }
14048
- }
14049
- }
14050
-
14051
- /*
14052
- * Copyright (c) Microsoft Corporation. All rights reserved.
14053
- * Licensed under the MIT License.
14054
- */
14055
- class AuthenticationMethodSelectionStateBaseV2 extends AuthFlowActionRequiredStateBase {
14056
- constructor(stateParameters) {
14057
- super(stateParameters);
14058
- this.methods = stateParameters.methods;
14059
- }
14060
- async requestSelectedMethodChallenge(method) {
14061
- const { correlationId, continuationState, flowClient } = this.stateParameters;
14062
- const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
14063
- if (!selectedMethod) {
14064
- throw new InvalidArgumentError("method", correlationId);
14065
- }
14066
- const result = await flowClient.requestChallenge({
14067
- correlationId,
14068
- continuationState: {
14069
- ...continuationState,
14070
- links: {
14071
- ...continuationState.links,
14072
- challenge: selectedMethod.challengeHref,
14073
- },
14074
- },
14075
- });
14076
- return { result, selectedMethod };
14077
- }
14078
- }
14079
-
14080
- /*
14081
- * Copyright (c) Microsoft Corporation. All rights reserved.
14082
- * Licensed under the MIT License.
14083
- */
14084
- /**
14085
- * State returned when sign-in requires a registered multi-factor
14086
- * authentication method.
14087
- */
14088
- class MFARequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
14089
- constructor() {
14090
- super(...arguments);
14091
- this.stateType = "mfaRequired";
14092
- }
14093
- /**
14094
- * Requests a challenge for a registered MFA method.
14095
- * @param method - A method from {@link methods}.
14096
- * @returns A result requiring challenge verification or describing failure.
14097
- */
14098
- async requestChallenge(method) {
14099
- const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14100
- try {
14101
- const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
14102
- if (result.type !== FLOW_CODE_REQUIRED_V2) {
14103
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA method selection expected a code challenge but received '${result.type}'.`, correlationId);
14104
- }
14105
- return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
14106
- correlationId: result.correlationId,
14107
- logger,
14108
- config: this.stateParameters.config,
14109
- flowClient,
14110
- continuationState: result.continuationState,
14111
- cacheClient: this.stateParameters.cacheClient,
14112
- method: selectedMethod,
14113
- sentTo: result.sentTo,
14114
- channel: result.channel,
14115
- codeLength: result.codeLength,
14116
- }), undefined, result.continuationState.scenario);
14117
- }
14118
- catch (error) {
14119
- logger.errorPii(`0ax1kt ${error}`, correlationId);
14120
- return CustomAuthResultV2.createWithError(error, {
14121
- errorType: RequestChallengeErrorV2,
14122
- scenario: continuationState.scenario,
14123
- correlationId,
14124
- });
14125
- }
14126
- }
14127
- }
14128
-
14129
14168
  /*
14130
14169
  * Copyright (c) Microsoft Corporation. All rights reserved.
14131
14170
  * Licensed under the MIT License.
@@ -14183,15 +14222,11 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14183
14222
  }), undefined, result.continuationState.scenario);
14184
14223
  }
14185
14224
  if (result.type === FLOW_MFA_REQUIRED_V2) {
14186
- return new CustomAuthResultV2(new MFARequiredStateV2({
14187
- correlationId: result.correlationId,
14188
- logger,
14189
- config: this.stateParameters.config,
14190
- flowClient: this.stateParameters.flowClient,
14191
- continuationState: result.continuationState,
14192
- cacheClient: this.stateParameters.cacheClient,
14193
- methods: result.methods,
14194
- }), undefined, result.continuationState.scenario);
14225
+ const signInStateTransitionHandler = this.stateParameters.signInStateTransitionHandler;
14226
+ if (!signInStateTransitionHandler) {
14227
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-in state transition handler is missing.", correlationId);
14228
+ }
14229
+ return signInStateTransitionHandler.handleMfaRequired(result, this.stateParameters);
14195
14230
  }
14196
14231
  if (result.type === FLOW_COMPLETED_V2) {
14197
14232
  const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
@@ -14202,7 +14237,6 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14202
14237
  catch (error) {
14203
14238
  logger.errorPii(`0br9qy ${error}`, correlationId);
14204
14239
  return CustomAuthResultV2.createWithError(error, {
14205
- errorType: VerifyChallengeErrorV2,
14206
14240
  scenario: continuationState.scenario,
14207
14241
  correlationId,
14208
14242
  });
@@ -14226,6 +14260,7 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14226
14260
  continuationState: result.continuationState,
14227
14261
  cacheClient: this.stateParameters.cacheClient,
14228
14262
  signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
14263
+ signInStateTransitionHandler: this.stateParameters.signInStateTransitionHandler,
14229
14264
  method: this.method,
14230
14265
  sentTo: result.sentTo,
14231
14266
  channel: result.channel,
@@ -14235,7 +14270,77 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14235
14270
  catch (error) {
14236
14271
  logger.errorPii(`0eq23q ${error}`, correlationId);
14237
14272
  return CustomAuthResultV2.createWithError(error, {
14238
- errorType: RequestChallengeErrorV2,
14273
+ scenario: continuationState.scenario,
14274
+ correlationId,
14275
+ });
14276
+ }
14277
+ }
14278
+ }
14279
+
14280
+ /*
14281
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14282
+ * Licensed under the MIT License.
14283
+ */
14284
+ /**
14285
+ * State returned when sign-in requires verification of an email or SMS MFA
14286
+ * challenge. It allows the app to submit the challenge or request a replacement.
14287
+ */
14288
+ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14289
+ constructor() {
14290
+ super(...arguments);
14291
+ this.stateType = "mfaVerificationRequired";
14292
+ }
14293
+ /**
14294
+ * Submits the email or SMS challenge as the second authentication factor.
14295
+ * Successful verification completes sign-in.
14296
+ * @param challenge - The challenge value to submit.
14297
+ * @returns The result of submitting the MFA challenge.
14298
+ */
14299
+ async submitChallenge(challenge) {
14300
+ const { correlationId, logger, continuationState } = this.stateParameters;
14301
+ try {
14302
+ logger.verbose("10k0lc", correlationId);
14303
+ const result = await this.submitCodeCore(challenge);
14304
+ if (result.type !== FLOW_COMPLETED_V2) {
14305
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
14306
+ }
14307
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14308
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14309
+ }
14310
+ catch (error) {
14311
+ logger.errorPii(`178w0g ${error}`, correlationId);
14312
+ return CustomAuthResultV2.createWithError(error, {
14313
+ scenario: continuationState.scenario,
14314
+ correlationId,
14315
+ });
14316
+ }
14317
+ }
14318
+ /**
14319
+ * Requests a replacement challenge for the selected MFA method. The
14320
+ * returned state contains the refreshed email or SMS challenge metadata.
14321
+ * @returns The result of requesting a replacement MFA challenge.
14322
+ */
14323
+ async resendChallenge() {
14324
+ const { correlationId, logger, continuationState } = this.stateParameters;
14325
+ try {
14326
+ logger.verbose("13st9u", correlationId);
14327
+ const result = await this.resendCodeCore();
14328
+ return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
14329
+ correlationId: result.correlationId,
14330
+ logger,
14331
+ config: this.stateParameters.config,
14332
+ flowClient: this.stateParameters.flowClient,
14333
+ continuationState: result.continuationState,
14334
+ cacheClient: this.stateParameters.cacheClient,
14335
+ method: this.method,
14336
+ sentTo: result.sentTo,
14337
+ channel: result.channel,
14338
+ codeLength: result.codeLength,
14339
+ }), undefined, result.continuationState.scenario);
14340
+ }
14341
+ catch (error) {
14342
+ logger.errorPii(`1qw1ey ${error}`, correlationId);
14343
+ return CustomAuthResultV2.createWithError(error, {
14239
14344
  scenario: continuationState.scenario,
14240
14345
  correlationId,
14241
14346
  });
@@ -14253,23 +14358,23 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14253
14358
  * methods and lets the app request a challenge for the chosen one. The flow
14254
14359
  * stays on this state until a challenge is successfully requested.
14255
14360
  */
14256
- class AuthMethodSelectionRequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
14257
- constructor() {
14258
- super(...arguments);
14361
+ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14362
+ constructor(stateParameters) {
14363
+ super(stateParameters);
14259
14364
  this.stateType = "authMethodSelectionRequired";
14365
+ this.methods = stateParameters.methods;
14260
14366
  }
14261
14367
  /**
14262
- * Requests a challenge for the selected authentication method. The returned
14368
+ * Selects an authentication method and requests its challenge. The returned
14263
14369
  * state identifies the credential the application must collect.
14264
- * @param method - The method to challenge, from {@link methods}.
14265
- * @returns The result of requesting the challenge.
14370
+ * @param method - The method to select, from {@link methods}.
14371
+ * @returns The result of selecting the method and requesting its challenge.
14266
14372
  */
14267
- async requestChallenge(method) {
14268
- const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14373
+ async selectAuthMethod(method) {
14374
+ const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, } = this.stateParameters;
14269
14375
  try {
14270
14376
  logger.verbose("1r2ypl", correlationId);
14271
14377
  const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
14272
- const resultType = result.type;
14273
14378
  const commonStateParameters = {
14274
14379
  correlationId: result.correlationId,
14275
14380
  logger,
@@ -14278,128 +14383,78 @@ class AuthMethodSelectionRequiredStateV2 extends AuthenticationMethodSelectionSt
14278
14383
  continuationState: result.continuationState,
14279
14384
  cacheClient: this.stateParameters.cacheClient,
14280
14385
  };
14281
- if (result.type === FLOW_CODE_REQUIRED_V2 &&
14386
+ if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
14387
+ result.type === FLOW_CODE_REQUIRED_V2 &&
14282
14388
  (result.channel?.toLowerCase() ===
14283
14389
  AuthenticationMethodTypeV2.EMAIL ||
14284
14390
  result.channel?.toLowerCase() ===
14285
14391
  AuthenticationMethodTypeV2.SMS)) {
14286
14392
  return new CustomAuthResultV2(new CodeRequiredStateV2({
14287
14393
  ...commonStateParameters,
14394
+ signInStateTransitionHandler,
14288
14395
  method: selectedMethod,
14289
14396
  sentTo: result.sentTo,
14290
14397
  channel: result.channel,
14291
14398
  codeLength: result.codeLength,
14292
14399
  }), undefined, result.continuationState.scenario);
14293
14400
  }
14294
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Challenge type '${resultType}' with channel '${result.type === FLOW_CODE_REQUIRED_V2
14295
- ? result.channel
14296
- : AuthenticationMethodTypeV2.PASSWORD}' is not supported for password reset.`, correlationId);
14297
- }
14298
- catch (error) {
14299
- logger.errorPii(`0z5x7r ${error}`, correlationId);
14300
- return CustomAuthResultV2.createWithError(error, {
14301
- errorType: RequestChallengeErrorV2,
14302
- scenario: continuationState.scenario,
14303
- correlationId,
14304
- });
14305
- }
14306
- }
14307
- }
14308
-
14309
- /*
14310
- * Copyright (c) Microsoft Corporation. All rights reserved.
14311
- * Licensed under the MIT License.
14312
- */
14313
- /**
14314
- * Error raised by the first call of the native auth V2 reset-password flow
14315
- * (`resetPasswordV2`). It surfaces only the detectors relevant to starting a
14316
- * password reset, so an app inspecting `result.error` sees a small, focused set.
14317
- * Any unrecognised failure carries no specific detector; inspect the error code
14318
- * (`unexpected_error` when the server gives none) and `errorDescription`.
14319
- */
14320
- class ResetPasswordStartErrorV2 extends AuthFlowErrorBaseV2 {
14321
- /**
14322
- * Checks if the supplied username is empty or invalid.
14323
- * @returns True if the username is invalid, false otherwise.
14324
- */
14325
- isInvalidUsername() {
14326
- return this.isUserInvalidError();
14327
- }
14328
- /**
14329
- * Checks if the error is due to the user not being found. Use it to tell the
14330
- * user no account matches the supplied username, rather than exposing a
14331
- * generic failure that hides the real cause.
14332
- * @returns True if the user was not found, false otherwise.
14333
- */
14334
- isUserNotFound() {
14335
- return this.isUserNotFoundError();
14336
- }
14337
- }
14338
-
14339
- /*
14340
- * Copyright (c) Microsoft Corporation. All rights reserved.
14341
- * Licensed under the MIT License.
14342
- */
14343
- /**
14344
- * Error returned when native auth V2 sign-in cannot start.
14345
- */
14346
- class SignInStartErrorV2 extends AuthFlowErrorBaseV2 {
14347
- /**
14348
- * Checks whether the service rejected the username parameter.
14349
- * @returns True when the username was empty or invalid.
14350
- */
14351
- isInvalidUsername() {
14352
- return this.isUserInvalidError();
14353
- }
14354
- /**
14355
- * Checks whether the supplied username does not identify an account.
14356
- * @returns True when the service reports that the user was not found.
14357
- */
14358
- isUserNotFound() {
14359
- return this.isUserNotFoundError();
14360
- }
14361
- /**
14362
- * Checks whether an automatically submitted password was rejected.
14363
- * @returns True when the password is incorrect.
14364
- */
14365
- isInvalidPassword() {
14366
- return this.isPasswordIncorrectError();
14367
- }
14368
- }
14369
-
14370
- /*
14371
- * Copyright (c) Microsoft Corporation. All rights reserved.
14372
- * Licensed under the MIT License.
14373
- */
14374
- /**
14375
- * Error returned when native auth V2 sign-up cannot start. It exposes
14376
- * detectors for failures that an app can correct without restarting the flow.
14377
- */
14378
- class SignUpStartErrorV2 extends AuthFlowErrorBaseV2 {
14379
- /**
14380
- * Checks whether an upfront password violates the tenant's password policy.
14381
- * Use it to prompt the user for a stronger password.
14382
- * @returns True when the password violates policy, otherwise false.
14383
- */
14384
- isInvalidPassword() {
14385
- return this.isPasswordPolicyViolationError();
14401
+ if (continuationState.scenario ===
14402
+ CustomAuthFlowScenarioV2.SignIn &&
14403
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
14404
+ result.type === FLOW_PASSWORD_REQUIRED_V2) {
14405
+ if (!signInStateTransitionHandler) {
14406
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-in method selection cannot map a password challenge without a sign-in transition handler.", correlationId);
14407
+ }
14408
+ return signInStateTransitionHandler.handlePasswordRequired(result, commonStateParameters);
14409
+ }
14410
+ if (authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR &&
14411
+ result.type === FLOW_CODE_REQUIRED_V2) {
14412
+ return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
14413
+ ...commonStateParameters,
14414
+ method: selectedMethod,
14415
+ sentTo: result.sentTo,
14416
+ channel: result.channel,
14417
+ codeLength: result.codeLength,
14418
+ }), undefined, result.continuationState.scenario);
14419
+ }
14420
+ const expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
14421
+ ? continuationState.scenario ===
14422
+ CustomAuthFlowScenarioV2.SignIn
14423
+ ? "an email or SMS code challenge or a password challenge for single-factor sign-in"
14424
+ : "an email or SMS code challenge for single-factor authentication"
14425
+ : "a code challenge for multi-factor authentication";
14426
+ const returnedChallenge = result.type === FLOW_CODE_REQUIRED_V2
14427
+ ? result.channel
14428
+ ? `a '${result.channel}' code challenge`
14429
+ : "a code challenge without a channel"
14430
+ : "a password challenge";
14431
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Authentication method selection expected ${expectedChallenge}, but the server returned ${returnedChallenge}.`, correlationId);
14432
+ }
14433
+ catch (error) {
14434
+ logger.errorPii(`0z5x7r ${error}`, correlationId);
14435
+ return CustomAuthResultV2.createWithError(error, {
14436
+ scenario: continuationState.scenario,
14437
+ correlationId,
14438
+ });
14439
+ }
14386
14440
  }
14387
- }
14388
-
14389
- /*
14390
- * Copyright (c) Microsoft Corporation. All rights reserved.
14391
- * Licensed under the MIT License.
14392
- */
14393
- /**
14394
- * Error returned when a password cannot be submitted for V2 sign-in.
14395
- */
14396
- class SubmitPasswordErrorV2 extends AuthFlowErrorBaseV2 {
14397
- /**
14398
- * Checks whether the supplied password was rejected.
14399
- * @returns True when the password is incorrect.
14400
- */
14401
- isInvalidPassword() {
14402
- return this.isPasswordIncorrectError();
14441
+ async requestSelectedMethodChallenge(method) {
14442
+ const { correlationId, continuationState, flowClient } = this.stateParameters;
14443
+ const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
14444
+ if (!selectedMethod) {
14445
+ throw new InvalidArgumentError("method", correlationId);
14446
+ }
14447
+ const result = await flowClient.requestChallenge({
14448
+ correlationId,
14449
+ continuationState: {
14450
+ ...continuationState,
14451
+ links: {
14452
+ ...continuationState.links,
14453
+ challenge: selectedMethod.challengeHref,
14454
+ },
14455
+ },
14456
+ });
14457
+ return { result, selectedMethod };
14403
14458
  }
14404
14459
  }
14405
14460
 
@@ -14436,7 +14491,7 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14436
14491
  return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14437
14492
  }
14438
14493
  if (result.type === FLOW_MFA_REQUIRED_V2) {
14439
- return new CustomAuthResultV2(new MFARequiredStateV2({
14494
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
14440
14495
  correlationId: result.correlationId,
14441
14496
  logger,
14442
14497
  config: this.stateParameters.config,
@@ -14444,6 +14499,7 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14444
14499
  continuationState: result.continuationState,
14445
14500
  cacheClient: this.stateParameters.cacheClient,
14446
14501
  methods: result.methods,
14502
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
14447
14503
  }), undefined, result.continuationState.scenario);
14448
14504
  }
14449
14505
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
@@ -14451,7 +14507,6 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14451
14507
  catch (error) {
14452
14508
  logger.errorPii(`0qvjzk ${error}`, correlationId);
14453
14509
  return CustomAuthResultV2.createWithError(error, {
14454
- errorType: SubmitPasswordErrorV2,
14455
14510
  scenario: continuationState.scenario,
14456
14511
  correlationId,
14457
14512
  });
@@ -14463,26 +14518,25 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14463
14518
  * Copyright (c) Microsoft Corporation. All rights reserved.
14464
14519
  * Licensed under the MIT License.
14465
14520
  */
14466
- /**
14467
- * Error returned when additional V2 sign-up attributes cannot be submitted. It
14468
- * identifies attribute failures that an app can correct and resubmit.
14469
- */
14470
- class SubmitAttributesErrorV2 extends AuthFlowErrorBaseV2 {
14471
- /**
14472
- * Checks whether the service requires attributes omitted from the request.
14473
- * Use it to collect the required attributes before resubmitting.
14474
- * @returns True when required attributes are missing, otherwise false.
14475
- */
14476
- isMissingRequiredAttributes() {
14477
- return this.getAttributeValidationDetails().some((detail) => detail.code === "attributeRequired");
14521
+ class SignInStateTransitionHandlerV2 {
14522
+ handlePasswordRequired(result, stateParameters) {
14523
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
14524
+ ...stateParameters,
14525
+ correlationId: result.correlationId,
14526
+ continuationState: result.continuationState,
14527
+ }), undefined, result.continuationState.scenario);
14478
14528
  }
14479
- /**
14480
- * Checks whether a submitted password violates the tenant's password policy.
14481
- * Use it to prompt the user for a stronger password.
14482
- * @returns True when the password violates policy, otherwise false.
14483
- */
14484
- isInvalidPassword() {
14485
- return this.isPasswordPolicyViolationError();
14529
+ handleMfaRequired(result, stateParameters) {
14530
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
14531
+ correlationId: result.correlationId,
14532
+ logger: stateParameters.logger,
14533
+ config: stateParameters.config,
14534
+ flowClient: stateParameters.flowClient,
14535
+ continuationState: result.continuationState,
14536
+ cacheClient: stateParameters.cacheClient,
14537
+ methods: result.methods,
14538
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
14539
+ }), undefined, result.continuationState.scenario);
14486
14540
  }
14487
14541
  }
14488
14542
 
@@ -14529,7 +14583,6 @@ class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
14529
14583
  catch (error) {
14530
14584
  logger.errorPii(`0l4w01 ${error}`, correlationId);
14531
14585
  return CustomAuthResultV2.createWithError(error, {
14532
- errorType: SubmitAttributesErrorV2,
14533
14586
  scenario: continuationState.scenario,
14534
14587
  correlationId,
14535
14588
  });
@@ -14568,7 +14621,6 @@ class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2
14568
14621
  catch (error) {
14569
14622
  logger.errorPii(`07t30r ${error}`, correlationId);
14570
14623
  return CustomAuthResultV2.createWithError(error, {
14571
- errorType: SubmitAttributesErrorV2,
14572
14624
  scenario: continuationState.scenario,
14573
14625
  correlationId,
14574
14626
  });
@@ -19943,6 +19995,116 @@ function getActiveAccount(browserStorage, correlationId) {
19943
19995
  return browserStorage.getActiveAccount(correlationId);
19944
19996
  }
19945
19997
 
19998
+ /*
19999
+ * Copyright (c) Microsoft Corporation. All rights reserved.
20000
+ * Licensed under the MIT License.
20001
+ */
20002
+ const POPUP_POLL_INTERVAL_MS = 30;
20003
+ let activePopupPoller;
20004
+ /**
20005
+ * Cancels legacy popup polling when an interaction is superseded.
20006
+ *
20007
+ * @internal
20008
+ * @param logger Logger for the interaction.
20009
+ */
20010
+ function cancelPendingPopupPollingResponse(logger) {
20011
+ if (activePopupPoller) {
20012
+ logger.verbose("0g9n3p", activePopupPoller.correlationId);
20013
+ activePopupPoller.cancel();
20014
+ }
20015
+ }
20016
+ /**
20017
+ * Monitors a popup window for a URL change to the same origin as the parent application.
20018
+ * Polls the popup at a specified interval until it is redirected back to the application,
20019
+ * closed by the user, or a navigation to a same-origin URL is detected. Once a same-origin
20020
+ * URL is detected, extracts the response string (query or hash) and resolves the promise.
20021
+ *
20022
+ * @param popupWindow - The popup window to monitor for navigation.
20023
+ * @param popupWindowParent - The parent window that opened the popup.
20024
+ * @param responseMode - Response mode (`"query"` | `"fragment"`) determines whether
20025
+ * to read `location.search` or `location.hash` from the popup once on the same
20026
+ * origin. Any value other than `"query"` is treated as fragment.
20027
+ * @param logger - Logger instance.
20028
+ * @param unloadWindow - Event handler to remove from the parent window on cleanup.
20029
+ * @param correlationId
20030
+ */
20031
+ async function monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadWindow, correlationId) {
20032
+ let poller;
20033
+ return new Promise((resolve, reject) => {
20034
+ logger.verbose("0cp91u", correlationId);
20035
+ const intervalId = window.setInterval(() => {
20036
+ if (popupWindow.closed) {
20037
+ logger.error("0n69wb", correlationId);
20038
+ window.clearInterval(intervalId);
20039
+ reject(new BrowserAuthError(userCancelled, correlationId));
20040
+ return;
20041
+ }
20042
+ let href = "";
20043
+ try {
20044
+ /*
20045
+ * Will throw if cross origin,
20046
+ * which should be caught and ignored
20047
+ * since we need the interval to keep running while on STS UI.
20048
+ */
20049
+ href = popupWindow.location.href;
20050
+ }
20051
+ catch (e) { }
20052
+ // Don't process blank pages or cross domain
20053
+ if (!href || href === "about:blank") {
20054
+ return;
20055
+ }
20056
+ window.clearInterval(intervalId);
20057
+ let responseString;
20058
+ if (responseMode === ResponseMode.QUERY) {
20059
+ responseString = popupWindow.location.search;
20060
+ }
20061
+ else {
20062
+ responseString = popupWindow.location.hash;
20063
+ }
20064
+ logger.verbose("0po9er", correlationId);
20065
+ resolve(responseString);
20066
+ }, POPUP_POLL_INTERVAL_MS);
20067
+ poller = {
20068
+ correlationId,
20069
+ cancel: () => {
20070
+ window.clearInterval(intervalId);
20071
+ if (activePopupPoller === poller) {
20072
+ activePopupPoller = undefined;
20073
+ }
20074
+ reject(new BrowserAuthError(interactionInProgressCancelled, correlationId));
20075
+ },
20076
+ };
20077
+ activePopupPoller = poller;
20078
+ }).finally(() => {
20079
+ if (poller && activePopupPoller === poller) {
20080
+ activePopupPoller = undefined;
20081
+ }
20082
+ cleanPopup(popupWindow, popupWindowParent, unloadWindow);
20083
+ });
20084
+ }
20085
+ /**
20086
+ * Performs cleanup operations after popup authentication.
20087
+ * Strips auth-response params (code/state) from the popup URL while it is still
20088
+ * open, closes the popup window, and removes the 'beforeunload' event listener
20089
+ * from the parent window.
20090
+ *
20091
+ * @param popupWindow - The popup window to be closed.
20092
+ * @param popupWindowParent - The parent window from which the event listener will be removed.
20093
+ * @param unloadWindow - The event handler function to remove.
20094
+ */
20095
+ function cleanPopup(popupWindow, popupWindowParent, unloadWindow) {
20096
+ if (!popupWindow.closed) {
20097
+ try {
20098
+ clearAuthResponseFromUrl(popupWindow);
20099
+ }
20100
+ catch {
20101
+ // Popup may have become cross-origin or otherwise inaccessible; ignore.
20102
+ }
20103
+ }
20104
+ popupWindow.close();
20105
+ popupWindowParent.removeEventListener("beforeunload", unloadWindow);
20106
+ }
20107
+
19946
20108
  /*
19947
20109
  * Copyright (c) Microsoft Corporation. All rights reserved.
19948
20110
  * Licensed under the MIT License.
@@ -20045,6 +20207,53 @@ class EventHandler {
20045
20207
  }
20046
20208
  }
20047
20209
 
20210
+ /*
20211
+ * Copyright (c) Microsoft Corporation. All rights reserved.
20212
+ * Licensed under the MIT License.
20213
+ */
20214
+ /**
20215
+ * Returns true when the supplied user agent is using Safari
20216
+ *
20217
+ * @internal
20218
+ */
20219
+ function isSafari(userAgent = typeof navigator !== "undefined"
20220
+ ? navigator.userAgent
20221
+ : "") {
20222
+ if (/OPR\/|OPiOS|PhantomJS|SamsungBrowser|Edge|EdgiOS|EdgA/.test(userAgent)) {
20223
+ return false;
20224
+ }
20225
+ const browserNavigator = typeof navigator !== "undefined"
20226
+ ? navigator
20227
+ : undefined;
20228
+ if (/Edg/.test(userAgent) ||
20229
+ browserNavigator?.userAgentData?.brands?.some((brand) => brand?.brand === "Microsoft Edge")) {
20230
+ return false;
20231
+ }
20232
+ if (/Electron|CriOS|Chrome|Trident|FxiOS|Firefox/.test(userAgent)) {
20233
+ return false;
20234
+ }
20235
+ return /Safari/.test(userAgent) || /AppleWebKit/.test(userAgent);
20236
+ }
20237
+ /**
20238
+ * Returns true when EAR should be used for the current request.
20239
+ *
20240
+ * Safari cannot complete EAR's cross-origin form POST, so requests configured
20241
+ * for EAR transparently use authorization code flow instead.
20242
+ *
20243
+ * @internal
20244
+ */
20245
+ function shouldUseEar(protocolMode, logger, performanceClient, correlationId, userAgent) {
20246
+ if (protocolMode !== ProtocolMode.EAR) {
20247
+ return false;
20248
+ }
20249
+ if (!isSafari(userAgent)) {
20250
+ return true;
20251
+ }
20252
+ logger.verbose("0wirye", correlationId);
20253
+ performanceClient.addFields({ "ext.earFallbackReason": "safari" }, correlationId);
20254
+ return false;
20255
+ }
20256
+
20048
20257
  /*
20049
20258
  * Copyright (c) Microsoft Corporation. All rights reserved.
20050
20259
  * Licensed under the MIT License.
@@ -21286,7 +21495,16 @@ function instrumentClientData(response, correlationId, performanceClient) {
21286
21495
  * @returns
21287
21496
  */
21288
21497
  async function getStandardParameters(config, authority, request, logger, performanceClient) {
21289
- const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority }, request, logger, performanceClient);
21498
+ const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority }, {
21499
+ ...request,
21500
+ /*
21501
+ * Computed here rather than per flow so every authorize request
21502
+ * carries it — GET, POST and EAR, interactive and silent alike.
21503
+ * A request may assert it instead when the topology, rather than
21504
+ * the current window, is what makes the popup unreachable.
21505
+ */
21506
+ popupOriginCheckDone: request.popupOriginCheckDone ?? computePocd(config) === 1,
21507
+ }, logger, performanceClient);
21290
21508
  addLibraryInfo(parameters, {
21291
21509
  sku: BrowserConstants.MSAL_SKU,
21292
21510
  version: version,
@@ -21340,6 +21558,15 @@ async function getAuthCodeRequestUrl(config, authority, request, logger, perform
21340
21558
  });
21341
21559
  return getAuthorizeUrl(authority, parameters);
21342
21560
  }
21561
+ function getAuthorizeFormAction(authority, request, parameters) {
21562
+ const queryParams = new Map();
21563
+ addExtraParameters(queryParams, request.extraQueryParameters || {});
21564
+ if (parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
21565
+ queryParams.delete(POPUP_ORIGIN_CHECK_DONE);
21566
+ }
21567
+ addCorrelationId(queryParams, request.correlationId);
21568
+ return getAuthorizeUrl(authority, queryParams);
21569
+ }
21343
21570
  /**
21344
21571
  * Builds the action URL + POST-body fields for the EAR /authorize form.
21345
21572
  */
@@ -21355,11 +21582,7 @@ async function getEARFormData(config, authority, request, logger, performanceCli
21355
21582
  addExtraParameters(parameters, {
21356
21583
  ...request.extraParameters,
21357
21584
  });
21358
- const queryParams = new Map();
21359
- addExtraParameters(queryParams, request.extraQueryParameters || {});
21360
- // Add correlationId to query params so gateway can propagate it to IDPs
21361
- addCorrelationId(queryParams, request.correlationId);
21362
- const action = getAuthorizeUrl(authority, queryParams);
21585
+ const action = getAuthorizeFormAction(authority, request, parameters);
21363
21586
  return { action, fields: Object.fromEntries(parameters) };
21364
21587
  }
21365
21588
  /**
@@ -21380,12 +21603,7 @@ async function getCodeFormData(config, authority, request, logger, performanceCl
21380
21603
  addExtraParameters(parameters, {
21381
21604
  ...request.extraParameters,
21382
21605
  });
21383
- // Add extraQueryParameters to be appended to request URL
21384
- const queryParams = new Map();
21385
- addExtraParameters(queryParams, request.extraQueryParameters || {});
21386
- // Add correlationId to query params so gateway can propagate it to IDPs
21387
- addCorrelationId(queryParams, request.correlationId);
21388
- const action = getAuthorizeUrl(authority, queryParams);
21606
+ const action = getAuthorizeFormAction(authority, request, parameters);
21389
21607
  return { action, fields: Object.fromEntries(parameters) };
21390
21608
  }
21391
21609
  /**
@@ -21772,7 +21990,7 @@ function getHeaderDict(headers) {
21772
21990
  */
21773
21991
  // Default timeout for popup windows and iframes in milliseconds
21774
21992
  const DEFAULT_POPUP_TIMEOUT_MS = 60000;
21775
- const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
21993
+ const DEFAULT_IFRAME_TIMEOUT_MS$1 = 10000;
21776
21994
  const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
21777
21995
  const DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;
21778
21996
  /**
@@ -21813,6 +22031,8 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
21813
22031
  instanceAware: false,
21814
22032
  isMcp: false,
21815
22033
  verifySSO: false,
22034
+ // Legacy polling needs COOP omitted, so it implies asserting pocd=1.
22035
+ originCheck: !userInputSystem?.enableLegacyPolling,
21816
22036
  };
21817
22037
  // Default cache options for browser
21818
22038
  const DEFAULT_CACHE_OPTIONS = {
@@ -21837,7 +22057,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
21837
22057
  : StubbedNetworkModule,
21838
22058
  navigationClient: new NavigationClient(),
21839
22059
  popupBridgeTimeout: userInputSystem?.popupBridgeTimeout || DEFAULT_POPUP_TIMEOUT_MS,
21840
- iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS,
22060
+ iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS$1,
21841
22061
  redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
21842
22062
  allowRedirectInIframe: false,
21843
22063
  navigatePopups: true,
@@ -21846,6 +22066,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
21846
22066
  DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
21847
22067
  protocolMode: ProtocolMode.AAD,
21848
22068
  serverTelemetryEnabled: false,
22069
+ enableLegacyPolling: false,
21849
22070
  };
21850
22071
  const providedSystemOptions = {
21851
22072
  ...DEFAULT_BROWSER_SYSTEM_OPTIONS,
@@ -21863,11 +22084,17 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
21863
22084
  iframeTimeoutTelemetry: false,
21864
22085
  allowPlatformBrokerWithDOM: false,
21865
22086
  };
22087
+ let logger;
22088
+ const getLogger = () => {
22089
+ if (!logger) {
22090
+ logger = new Logger(providedSystemOptions.loggerOptions, name, version);
22091
+ }
22092
+ return logger;
22093
+ };
21866
22094
  // Throw an error if user has set OIDCOptions without being in OIDC protocol mode
21867
22095
  if (userInputSystem?.protocolMode !== ProtocolMode.OIDC &&
21868
22096
  userInputAuth?.OIDCOptions) {
21869
- const logger = new Logger(providedSystemOptions.loggerOptions, name, version);
21870
- logger.warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
22097
+ getLogger().warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
21871
22098
  }
21872
22099
  // Throw an error if user has set allowPlatformBroker to true with OIDC protocol mode
21873
22100
  if (userInputSystem?.protocolMode &&
@@ -21875,6 +22102,24 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
21875
22102
  providedSystemOptions?.allowPlatformBroker) {
21876
22103
  throw createClientConfigurationError(cannotAllowPlatformBroker, "");
21877
22104
  }
22105
+ /*
22106
+ * The origin check computes 0 in the embedded contexts legacy polling
22107
+ * serves, so re-enabling it there breaks the flow. Honor it, but warn.
22108
+ */
22109
+ if (userInputSystem?.enableLegacyPolling &&
22110
+ userInputAuth?.originCheck === true) {
22111
+ getLogger().warning("buildConfiguration: system.enableLegacyPolling is true and auth.originCheck is explicitly true. Legacy polling requires pocd=1, which the origin check will not produce in an embedded context. Unset auth.originCheck to let legacy polling assert it.", "");
22112
+ }
22113
+ /*
22114
+ * Opting out is a deliberate risk transfer, not an error — but the app
22115
+ * cannot know at config time that the risky topology is actually present.
22116
+ */
22117
+ if ((userInputAuth?.originCheck ?? DEFAULT_AUTH_OPTIONS.originCheck) ===
22118
+ false &&
22119
+ typeof window !== "undefined" &&
22120
+ !topOpenerIsSameOriginOrAbsent(window)) {
22121
+ getLogger().warning("buildConfiguration: auth.originCheck is disabled and the top-level window has a cross-origin opener. MSAL will assert pocd=1, so the STS omits Cross-Origin-Opener-Policy and that opener can reach the auth popup. The application is responsible for this risk.", "");
22122
+ }
21878
22123
  const overlayedConfig = {
21879
22124
  auth: {
21880
22125
  ...DEFAULT_AUTH_OPTIONS,
@@ -22683,6 +22928,9 @@ class PopupClient extends StandardInteractionClient {
22683
22928
  popupWindowAttributes: logoutRequest?.popupWindowAttributes || {},
22684
22929
  popupWindowParent: logoutRequest?.popupWindowParent ?? window,
22685
22930
  };
22931
+ validLogoutRequest.popupOriginCheckDone =
22932
+ this.getPopupOriginCheckDone(popupParams.popupWindowParent) ??
22933
+ validLogoutRequest.popupOriginCheckDone;
22686
22934
  const authority = logoutRequest && logoutRequest.authority;
22687
22935
  const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
22688
22936
  // navigatePopups flag set to false. Acquires token without first opening popup. Popup will be opened later asynchronously.
@@ -22723,7 +22971,7 @@ class PopupClient extends StandardInteractionClient {
22723
22971
  }
22724
22972
  const isPlatformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, request.authenticationScheme);
22725
22973
  validRequest.platformBroker = isPlatformBroker;
22726
- if (this.config.system.protocolMode === ProtocolMode.EAR) {
22974
+ if (shouldUseEar(this.config.system.protocolMode, this.logger, this.performanceClient, this.correlationId)) {
22727
22975
  return this.executeEarFlow(validRequest, popupParams, pkceCodes);
22728
22976
  }
22729
22977
  else {
@@ -22747,6 +22995,7 @@ class PopupClient extends StandardInteractionClient {
22747
22995
  ...request,
22748
22996
  codeChallenge: pkce.challenge,
22749
22997
  ...tokenBindingParams,
22998
+ popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
22750
22999
  };
22751
23000
  try {
22752
23001
  // Initialize the client
@@ -22810,6 +23059,7 @@ class PopupClient extends StandardInteractionClient {
22810
23059
  earJwk: earJwk,
22811
23060
  codeChallenge: pkce.challenge,
22812
23061
  ...tokenBindingParams,
23062
+ popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
22813
23063
  };
22814
23064
  const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
22815
23065
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
@@ -23082,6 +23332,27 @@ class PopupClient extends StandardInteractionClient {
23082
23332
  getRelayStateId(state, correlationId) {
23083
23333
  return parseRequestState(base64Decode, state, correlationId).libraryState.id;
23084
23334
  }
23335
+ /**
23336
+ * Asserts `pocd=1` for the relay flow. Direct popups also require the
23337
+ * environment of a delegated opening window to pass the origin check.
23338
+ *
23339
+ * With a relay the IdP window is a grandchild popup, which an untrusted
23340
+ * ancestor cannot reach by name — so the topology satisfies the check by
23341
+ * construction. The current window is framed and would otherwise compute
23342
+ * `0`. Without a delegated parent, the standard app check remains unchanged.
23343
+ *
23344
+ * @param popupWindowParent Window that opens the popup.
23345
+ */
23346
+ getPopupOriginCheckDone(popupWindowParent) {
23347
+ if (this.config.auth.popupRelayUri) {
23348
+ return true;
23349
+ }
23350
+ if (popupWindowParent !== window) {
23351
+ return (computePocd(this.config) === 1 &&
23352
+ computePocd(this.config, popupWindowParent) === 1);
23353
+ }
23354
+ return undefined;
23355
+ }
23085
23356
  /**
23086
23357
  * Opens the interactive popup for a POST-form /authorize request. Shared by
23087
23358
  * the auth-code POST and EAR flows, which are identical apart from the form
@@ -23177,7 +23448,7 @@ class RedirectClient extends StandardInteractionClient {
23177
23448
  // Clear temporary cache if the back button is clicked during the redirect flow.
23178
23449
  window.addEventListener("pageshow", handleBackButton);
23179
23450
  try {
23180
- const redirectOperation = this.config.system.protocolMode === ProtocolMode.EAR
23451
+ const redirectOperation = shouldUseEar(this.config.system.protocolMode, this.logger, this.performanceClient, this.correlationId)
23181
23452
  ? this.executeEarFlow(validRequest)
23182
23453
  : this.executeCodeFlow(validRequest);
23183
23454
  await Promise.race([redirectOperation, backButtonCancellation]);
@@ -23404,7 +23675,6 @@ class RedirectClient extends StandardInteractionClient {
23404
23675
  }
23405
23676
  return [null, ""];
23406
23677
  }
23407
- clearHash(window);
23408
23678
  this.logger.verbose("00uvho", this.correlationId);
23409
23679
  return [response, responseString];
23410
23680
  }
@@ -23679,7 +23949,7 @@ class SilentIframeClient extends StandardInteractionClient {
23679
23949
  const silentRequest = await invokeAsync(initializeAuthorizationRequest, StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(inputRequest, InteractionType.Silent, this.config, this.browserCrypto, this.browserStorage, this.logger, this.performanceClient, this.correlationId);
23680
23950
  silentRequest.platformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, silentRequest.authenticationScheme);
23681
23951
  preconnect(silentRequest.authority);
23682
- if (this.config.system.protocolMode === ProtocolMode.EAR) {
23952
+ if (shouldUseEar(this.config.system.protocolMode, this.logger, this.performanceClient, this.correlationId)) {
23683
23953
  return this.executeEarFlow(silentRequest);
23684
23954
  }
23685
23955
  else {
@@ -24063,14 +24333,20 @@ function resolveSilentRequestPreparation(input, platformAuthProvider, logger, pe
24063
24333
  return prepareRequest(input);
24064
24334
  }
24065
24335
  /**
24066
- * Preserves the standard web thumbprint and caller-owned request references.
24336
+ * Extends the web thumbprint with silent-flow options while preserving caller-owned references.
24067
24337
  */
24068
24338
  function prepareWebSilentRequest({ request, account, correlationId, config, }) {
24069
24339
  const thumbprint = getRequestThumbprint(config.auth.clientId, {
24070
24340
  ...request,
24071
24341
  authority: request.authority || config.auth.authority}, account.homeAccountId);
24072
24342
  return {
24073
- key: JSON.stringify(thumbprint),
24343
+ key: JSON.stringify({
24344
+ ...thumbprint,
24345
+ forceRefresh: !!request.forceRefresh,
24346
+ cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
24347
+ extraParameters: canonicalizeStringDict(request.extraParameters),
24348
+ extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
24349
+ }),
24074
24350
  request,
24075
24351
  account,
24076
24352
  };
@@ -24357,7 +24633,32 @@ class StandardController {
24357
24633
  * @returns
24358
24634
  */
24359
24635
  async handleRedirectPromiseInternal(options) {
24360
- if (!this.browserStorage.isInteractionInProgress(true)) {
24636
+ // Preserve the response for RedirectClient before removing it from the URL.
24637
+ const responseString = options?.hash ||
24638
+ (this.config.auth.OIDCOptions.responseMode ===
24639
+ ResponseMode.QUERY
24640
+ ? window.location.search
24641
+ : window.location.hash);
24642
+ const anyClientInteractionInProgress = this.browserStorage.isInteractionInProgress(false);
24643
+ const currentClientInteraction = this.browserStorage.isInteractionInProgress(true);
24644
+ const isBridgeCallback = isInPopup() ||
24645
+ (isInIframe() &&
24646
+ !this.config.system.allowRedirectInIframe);
24647
+ /*
24648
+ * Clear recognized response fragments for:
24649
+ * - Stale callbacks with no pending interaction.
24650
+ * - This client's login callback, even if request setup or response validation fails.
24651
+ * - This client's logout callback containing state, before the SIGNOUT early return.
24652
+ * Leave another client's callback untouched. clearHash preserves query strings
24653
+ * and application routes, and does nothing when no response fragment is present.
24654
+ * Skip popup and non-redirect iframe callbacks: legacy apps may call HRP
24655
+ * before their redirect bridge reads and broadcasts the response.
24656
+ */
24657
+ if (!isBridgeCallback &&
24658
+ (!anyClientInteractionInProgress || currentClientInteraction)) {
24659
+ clearHash(window);
24660
+ }
24661
+ if (!currentClientInteraction) {
24361
24662
  this.logger.info("0le6uv", "");
24362
24663
  return null;
24363
24664
  }
@@ -24365,7 +24666,7 @@ class StandardController {
24365
24666
  if (interactionType === INTERACTION_TYPE.SIGNOUT) {
24366
24667
  this.logger.verbose("1ywcv2", "");
24367
24668
  this.browserStorage.setInteractionInProgress(false);
24368
- return Promise.resolve(null);
24669
+ return null;
24369
24670
  }
24370
24671
  const loggedInAccounts = this.getAllAccounts();
24371
24672
  const platformBrokerRequest = this.browserStorage.getCachedNativeRequest();
@@ -24395,7 +24696,9 @@ class StandardController {
24395
24696
  rootMeasurement = this.performanceClient.startMeasurement(AcquireTokenRedirect, correlationId);
24396
24697
  this.logger.trace("0znzs5", correlationId);
24397
24698
  const redirectClient = this.createRedirectClient(correlationId);
24398
- redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options);
24699
+ redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options?.hash
24700
+ ? options
24701
+ : { ...options, hash: responseString });
24399
24702
  }
24400
24703
  }
24401
24704
  catch (e) {
@@ -24543,6 +24846,9 @@ class StandardController {
24543
24846
  this.logger.verbose("0ch87b", correlationId);
24544
24847
  preflightCheck(this.initialized, atPopupMeasurement, this.config, request);
24545
24848
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNIN, request.overrideInteractionInProgress, correlationId);
24849
+ if (request.overrideInteractionInProgress) {
24850
+ cancelPendingPopupPollingResponse(this.logger);
24851
+ }
24546
24852
  }
24547
24853
  catch (e) {
24548
24854
  // Since this function is syncronous we need to reject
@@ -25681,6 +25987,7 @@ class CustomAuthStandardController extends StandardController {
25681
25987
  constructor(operatingContext, customAuthApiClient, customAuthApiClientV2) {
25682
25988
  super(operatingContext);
25683
25989
  this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
25990
+ this.signInStateTransitionHandlerV2 = new SignInStateTransitionHandlerV2();
25684
25991
  if (!this.isBrowserEnvironment) {
25685
25992
  this.logger.verbose("1f7i3q", "");
25686
25993
  throw new UnsupportedEnvironmentError();
@@ -25958,11 +26265,19 @@ class CustomAuthStandardController extends StandardController {
25958
26265
  try {
25959
26266
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
25960
26267
  ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
26268
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
26269
+ ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
26270
+ }
26271
+ if (inputs.claims) {
26272
+ ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
26273
+ }
25961
26274
  this.ensureUserNotSignedIn(correlationId);
25962
26275
  this.logger.verbose("0301h1", correlationId);
25963
26276
  const result = await this.flowClientV2.resetPassword({
25964
26277
  correlationId,
25965
26278
  username: inputs.username,
26279
+ scopes: inputs.scopes,
26280
+ claims: inputs.claims,
25966
26281
  });
25967
26282
  this.logger.verbose("1yrzgs", correlationId);
25968
26283
  if (result.type === FLOW_CODE_REQUIRED_V2) {
@@ -25987,12 +26302,12 @@ class CustomAuthStandardController extends StandardController {
25987
26302
  continuationState: result.continuationState,
25988
26303
  cacheClient: this.cacheClient,
25989
26304
  methods: result.methods,
26305
+ authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
25990
26306
  }), undefined, result.continuationState.scenario);
25991
26307
  }
25992
26308
  catch (error) {
25993
26309
  this.logger.errorPii(`1f279y ${error}`, correlationId);
25994
26310
  return CustomAuthResultV2.createWithError(error, {
25995
- errorType: ResetPasswordStartErrorV2,
25996
26311
  scenario: CustomAuthFlowScenarioV2.PasswordReset,
25997
26312
  correlationId,
25998
26313
  });
@@ -26003,6 +26318,9 @@ class CustomAuthStandardController extends StandardController {
26003
26318
  try {
26004
26319
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
26005
26320
  ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
26321
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
26322
+ ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
26323
+ }
26006
26324
  if (inputs.claims) {
26007
26325
  ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
26008
26326
  }
@@ -26013,19 +26331,19 @@ class CustomAuthStandardController extends StandardController {
26013
26331
  username: inputs.username,
26014
26332
  password: inputs.password,
26015
26333
  scopes: inputs.scopes,
26334
+ claims: inputs.claims,
26016
26335
  });
26017
26336
  if (result.type === FLOW_COMPLETED_V2) {
26018
26337
  return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
26019
26338
  }
26020
- if (result.type === FLOW_MFA_REQUIRED_V2) {
26021
- return new CustomAuthResultV2(new MFARequiredStateV2({
26339
+ if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
26340
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
26022
26341
  correlationId: result.correlationId,
26023
26342
  logger: this.logger,
26024
26343
  config: this.customAuthConfig,
26025
26344
  flowClient: this.flowClientV2,
26026
26345
  continuationState: result.continuationState,
26027
26346
  cacheClient: this.cacheClient,
26028
- methods: result.methods,
26029
26347
  }), undefined, result.continuationState.scenario);
26030
26348
  }
26031
26349
  if (result.type === FLOW_CODE_REQUIRED_V2) {
@@ -26036,20 +26354,36 @@ class CustomAuthStandardController extends StandardController {
26036
26354
  flowClient: this.flowClientV2,
26037
26355
  continuationState: result.continuationState,
26038
26356
  cacheClient: this.cacheClient,
26357
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
26039
26358
  method: result.method,
26040
26359
  sentTo: result.sentTo,
26041
26360
  channel: result.channel,
26042
26361
  codeLength: result.codeLength,
26043
26362
  }), undefined, result.continuationState.scenario);
26044
26363
  }
26045
- if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
26046
- return new CustomAuthResultV2(new PasswordRequiredStateV2({
26364
+ if (result.type === FLOW_METHOD_SELECTION_REQUIRED_V2) {
26365
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
26366
+ correlationId: result.correlationId,
26367
+ logger: this.logger,
26368
+ config: this.customAuthConfig,
26369
+ flowClient: this.flowClientV2,
26370
+ continuationState: result.continuationState,
26371
+ cacheClient: this.cacheClient,
26372
+ methods: result.methods,
26373
+ authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
26374
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
26375
+ }), undefined, result.continuationState.scenario);
26376
+ }
26377
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
26378
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
26047
26379
  correlationId: result.correlationId,
26048
26380
  logger: this.logger,
26049
26381
  config: this.customAuthConfig,
26050
26382
  flowClient: this.flowClientV2,
26051
26383
  continuationState: result.continuationState,
26052
26384
  cacheClient: this.cacheClient,
26385
+ methods: result.methods,
26386
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
26053
26387
  }), undefined, result.continuationState.scenario);
26054
26388
  }
26055
26389
  throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
@@ -26057,7 +26391,6 @@ class CustomAuthStandardController extends StandardController {
26057
26391
  catch (error) {
26058
26392
  this.logger.errorPii(`11afy0 ${error}`, correlationId);
26059
26393
  return CustomAuthResultV2.createWithError(error, {
26060
- errorType: SignInStartErrorV2,
26061
26394
  scenario: CustomAuthFlowScenarioV2.SignIn,
26062
26395
  correlationId,
26063
26396
  });
@@ -26072,6 +26405,12 @@ class CustomAuthStandardController extends StandardController {
26072
26405
  ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
26073
26406
  ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
26074
26407
  }
26408
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
26409
+ ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
26410
+ }
26411
+ if (inputs.claims) {
26412
+ ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
26413
+ }
26075
26414
  this.ensureUserNotSignedIn(correlationId);
26076
26415
  this.logger.verbose("0010xn", correlationId);
26077
26416
  const result = await this.flowClientV2.signUp({
@@ -26117,7 +26456,6 @@ class CustomAuthStandardController extends StandardController {
26117
26456
  catch (error) {
26118
26457
  this.logger.errorPii(`196wno ${error}`, correlationId);
26119
26458
  return CustomAuthResultV2.createWithError(error, {
26120
- errorType: SignUpStartErrorV2,
26121
26459
  scenario: CustomAuthFlowScenarioV2.SignUp,
26122
26460
  correlationId,
26123
26461
  });
@@ -26609,6 +26947,79 @@ NestedAppOperatingContext.MODULE_NAME = "";
26609
26947
  */
26610
26948
  NestedAppOperatingContext.ID = "NestedAppOperatingContext";
26611
26949
 
26950
+ /*
26951
+ * Copyright (c) Microsoft Corporation. All rights reserved.
26952
+ * Licensed under the MIT License.
26953
+ */
26954
+ const IFRAME_POLL_INTERVAL_MS = 50;
26955
+ const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
26956
+ /**
26957
+ * Monitors an iframe content window until it loads a URL with a known hash, or hits a specified timeout.
26958
+ *
26959
+ * @param iframe - The hidden iframe to monitor.
26960
+ * @param timeout - Maximum time (ms) to wait for navigation before rejecting with
26961
+ * `monitor_window_timeout`.
26962
+ * @param logger - Logger instance.
26963
+ * @param correlationId
26964
+ * @param responseMode - `"query"` or `"fragment"` — determines whether to read
26965
+ * `location.search` or `location.hash`. Any value other than `"query"` is
26966
+ * treated as fragment.
26967
+ */
26968
+ async function monitorIframeForHash(iframe, timeout, logger, correlationId, responseMode) {
26969
+ return new Promise((resolve, reject) => {
26970
+ if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
26971
+ logger.warning(`137tec ${timeout} ${DEFAULT_IFRAME_TIMEOUT_MS}`, correlationId);
26972
+ }
26973
+ /*
26974
+ * Polling for iframes can be purely timing based,
26975
+ * since we don't need to account for interaction.
26976
+ */
26977
+ const timeoutId = window.setTimeout(() => {
26978
+ window.clearInterval(intervalId);
26979
+ reject(new AuthError(timedOut, correlationId, undefined, "monitor_window_timeout"));
26980
+ }, timeout);
26981
+ const intervalId = window.setInterval(() => {
26982
+ const contentWindow = iframe.contentWindow;
26983
+ if (!contentWindow) {
26984
+ return;
26985
+ }
26986
+ let href = "";
26987
+ try {
26988
+ /*
26989
+ * Will throw if cross origin,
26990
+ * which should be caught and ignored
26991
+ * since we need the interval to keep running while on STS UI.
26992
+ */
26993
+ href = contentWindow.location.href;
26994
+ }
26995
+ catch (e) { }
26996
+ if (!href || href === "about:blank") {
26997
+ return;
26998
+ }
26999
+ const responseString = responseMode === ResponseMode.QUERY
27000
+ ? contentWindow.location.search
27001
+ : contentWindow.location.hash;
27002
+ window.clearTimeout(timeoutId);
27003
+ window.clearInterval(intervalId);
27004
+ resolve(responseString);
27005
+ }, IFRAME_POLL_INTERVAL_MS);
27006
+ }).finally(() => {
27007
+ /*
27008
+ * Strip auth-response params from the iframe URL. The monitor owns the
27009
+ * iframe for the duration of the poll, mirroring cleanPopup in
27010
+ * PopupMonitor.
27011
+ */
27012
+ try {
27013
+ if (iframe.contentWindow) {
27014
+ clearAuthResponseFromUrl(iframe.contentWindow);
27015
+ }
27016
+ }
27017
+ catch {
27018
+ // Iframe may already be navigated away or cross-origin; ignore.
27019
+ }
27020
+ });
27021
+ }
27022
+
26612
27023
  /*
26613
27024
  * Copyright (c) Microsoft Corporation. All rights reserved.
26614
27025
  * Licensed under the MIT License.
@@ -26651,27 +27062,29 @@ class PublicClientApplication {
26651
27062
  /**
26652
27063
  * Waits for the auth response from a popup window opened by MSAL.
26653
27064
  *
26654
- * The default implementation delegates to MSAL's `BroadcastChannel`-based bridge.
26655
- * Subclasses must return the raw response string (hash/query/fragment), or reject
26656
- * with an `AuthError` on failure.
27065
+ * The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
27066
+ * or to the v4-style same-origin location poller when
27067
+ * `system.enableLegacyPolling` is set. Subclasses must return the raw response
27068
+ * string (hash/query/fragment), or reject with an `AuthError` on failure.
26657
27069
  *
26658
27070
  * @internal
26659
27071
  * @param request The in-flight authorization or end-session request.
26660
27072
  * @param popupWindow The popup window opened by MSAL.
26661
27073
  * @param popupWindowParent The parent window that opened the popup.
26662
27074
  */
26663
- async waitForPopupResponse(request,
26664
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
26665
- popupWindow,
26666
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
26667
- popupWindowParent) {
27075
+ async waitForPopupResponse(request, popupWindow, popupWindowParent) {
26668
27076
  const controller = this.controller;
26669
- return waitForBridgeResponse(controller.getConfiguration().system.popupBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient());
27077
+ const config = controller.getConfiguration();
27078
+ if (config.system.enableLegacyPolling) {
27079
+ return waitForPopupPollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), request, popupWindow, popupWindowParent);
27080
+ }
27081
+ return waitForBridgeResponse(config.system.popupBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient());
26670
27082
  }
26671
27083
  /**
26672
27084
  * Waits for the auth response from a hidden iframe used by MSAL silent flows.
26673
27085
  *
26674
- * The default implementation delegates to MSAL's `BroadcastChannel`-based bridge.
27086
+ * The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
27087
+ * or to the v4-style location poller when `system.enableLegacyPolling` is set.
26675
27088
  * Subclasses must return the raw response string (hash/query/fragment), or reject
26676
27089
  * with an `AuthError` on failure.
26677
27090
  *
@@ -26679,11 +27092,12 @@ class PublicClientApplication {
26679
27092
  * @param iframe The hidden iframe MSAL attached to the document.
26680
27093
  * @param request The in-flight authorization request.
26681
27094
  */
26682
- async waitForIframeResponse(
26683
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
26684
- iframe, request) {
27095
+ async waitForIframeResponse(iframe, request) {
26685
27096
  const controller = this.controller;
26686
27097
  const config = controller.getConfiguration();
27098
+ if (config.system.enableLegacyPolling) {
27099
+ return waitForIframePollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), iframe, request);
27100
+ }
26687
27101
  return waitForBridgeResponse(config.system.iframeBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient(), config.experimental);
26688
27102
  }
26689
27103
  /**
@@ -26916,6 +27330,40 @@ class PublicClientApplication {
26916
27330
  clearCache(logoutRequest) {
26917
27331
  return this.controller.clearCache(logoutRequest);
26918
27332
  }
27333
+ }
27334
+ /**
27335
+ * Collects a popup auth response using the v4-style same-origin location
27336
+ * poller instead of the `BroadcastChannel` redirect bridge.
27337
+ */
27338
+ async function waitForPopupPollingResponse(config, logger, performanceClient, request, popupWindow, popupWindowParent) {
27339
+ const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode.QUERY
27340
+ ? ResponseMode.QUERY
27341
+ : ResponseMode.FRAGMENT;
27342
+ performanceClient.addFields({ usesLegacyPolling: true }, request.correlationId);
27343
+ const unloadHandler = () => {
27344
+ try {
27345
+ if (popupWindow && !popupWindow.closed) {
27346
+ popupWindow.close();
27347
+ }
27348
+ }
27349
+ catch {
27350
+ /* ignore */
27351
+ }
27352
+ };
27353
+ popupWindowParent.addEventListener("beforeunload", unloadHandler);
27354
+ return monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadHandler, request.correlationId);
27355
+ }
27356
+ /**
27357
+ * Collects a silent-iframe auth response using the v4-style location poller
27358
+ * instead of the `BroadcastChannel` redirect bridge.
27359
+ */
27360
+ async function waitForIframePollingResponse(config, logger, performanceClient, iframe, request) {
27361
+ const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode.QUERY
27362
+ ? ResponseMode.QUERY
27363
+ : ResponseMode.FRAGMENT;
27364
+ const iframePollTimeout = config.system.iframeBridgeTimeout;
27365
+ performanceClient.addFields({ usesLegacyPolling: true, iframePollTimeout }, request.correlationId);
27366
+ return monitorIframeForHash(iframe, iframePollTimeout, logger, request.correlationId, responseMode);
26919
27367
  }
26920
27368
 
26921
27369
  /*
@@ -27051,6 +27499,7 @@ class UserAccountAttributeError extends CustomAuthError {
27051
27499
 
27052
27500
  exports.AttributesRequiredStateV2 = AttributesRequiredStateV2;
27053
27501
  exports.AuthFlowActionRequiredStateBase = AuthFlowActionRequiredStateBase;
27502
+ exports.AuthFlowErrorV2 = AuthFlowErrorV2;
27054
27503
  exports.AuthFlowStateBase = AuthFlowStateBase;
27055
27504
  exports.AuthMethodRegistrationChallengeMethodError = AuthMethodRegistrationChallengeMethodError;
27056
27505
  exports.AuthMethodRegistrationChallengeMethodResult = AuthMethodRegistrationChallengeMethodResult;
@@ -27077,7 +27526,6 @@ exports.GetCurrentAccountAccessTokenError = GetCurrentAccountAccessTokenError;
27077
27526
  exports.HttpError = HttpError;
27078
27527
  exports.InvalidArgumentError = InvalidArgumentError;
27079
27528
  exports.InvalidConfigurationError = InvalidConfigurationError;
27080
- exports.MFARequiredStateV2 = MFARequiredStateV2;
27081
27529
  exports.MFAVerificationRequiredStateV2 = MFAVerificationRequiredStateV2;
27082
27530
  exports.MethodNotImplementedError = MethodNotImplementedError;
27083
27531
  exports.MfaAwaitingState = MfaAwaitingState;
@@ -27093,7 +27541,6 @@ exports.NewPasswordRequiredStateV2 = NewPasswordRequiredStateV2;
27093
27541
  exports.NoCachedAccountFoundError = NoCachedAccountFoundError;
27094
27542
  exports.ParsedUrlError = ParsedUrlError;
27095
27543
  exports.PasswordRequiredStateV2 = PasswordRequiredStateV2;
27096
- exports.RequestChallengeErrorV2 = RequestChallengeErrorV2;
27097
27544
  exports.ResetPasswordCodeRequiredState = ResetPasswordCodeRequiredState;
27098
27545
  exports.ResetPasswordCompletedState = ResetPasswordCompletedState;
27099
27546
  exports.ResetPasswordError = ResetPasswordError;
@@ -27101,7 +27548,6 @@ exports.ResetPasswordFailedState = ResetPasswordFailedState;
27101
27548
  exports.ResetPasswordPasswordRequiredState = ResetPasswordPasswordRequiredState;
27102
27549
  exports.ResetPasswordResendCodeError = ResetPasswordResendCodeError;
27103
27550
  exports.ResetPasswordResendCodeResult = ResetPasswordResendCodeResult;
27104
- exports.ResetPasswordStartErrorV2 = ResetPasswordStartErrorV2;
27105
27551
  exports.ResetPasswordStartResult = ResetPasswordStartResult;
27106
27552
  exports.ResetPasswordState = ResetPasswordState;
27107
27553
  exports.ResetPasswordSubmitCodeError = ResetPasswordSubmitCodeError;
@@ -27110,7 +27556,6 @@ exports.ResetPasswordSubmitPasswordError = ResetPasswordSubmitPasswordError;
27110
27556
  exports.ResetPasswordSubmitPasswordResult = ResetPasswordSubmitPasswordResult;
27111
27557
  exports.SignInCodeRequiredState = SignInCodeRequiredState;
27112
27558
  exports.SignInCompletedState = SignInCompletedState;
27113
- exports.SignInContinuationErrorV2 = SignInContinuationErrorV2;
27114
27559
  exports.SignInContinuationState = SignInContinuationState;
27115
27560
  exports.SignInContinuationStateV2 = SignInContinuationStateV2;
27116
27561
  exports.SignInError = SignInError;
@@ -27119,7 +27564,6 @@ exports.SignInPasswordRequiredState = SignInPasswordRequiredState;
27119
27564
  exports.SignInResendCodeError = SignInResendCodeError;
27120
27565
  exports.SignInResendCodeResult = SignInResendCodeResult;
27121
27566
  exports.SignInResult = SignInResult;
27122
- exports.SignInStartErrorV2 = SignInStartErrorV2;
27123
27567
  exports.SignInState = SignInState;
27124
27568
  exports.SignInSubmitCodeError = SignInSubmitCodeError;
27125
27569
  exports.SignInSubmitCodeResult = SignInSubmitCodeResult;
@@ -27137,7 +27581,6 @@ exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
27137
27581
  exports.SignUpResendCodeError = SignUpResendCodeError;
27138
27582
  exports.SignUpResendCodeResult = SignUpResendCodeResult;
27139
27583
  exports.SignUpResult = SignUpResult;
27140
- exports.SignUpStartErrorV2 = SignUpStartErrorV2;
27141
27584
  exports.SignUpState = SignUpState;
27142
27585
  exports.SignUpSubmitAttributesError = SignUpSubmitAttributesError;
27143
27586
  exports.SignUpSubmitAttributesResult = SignUpSubmitAttributesResult;
@@ -27145,12 +27588,8 @@ exports.SignUpSubmitCodeError = SignUpSubmitCodeError;
27145
27588
  exports.SignUpSubmitCodeResult = SignUpSubmitCodeResult;
27146
27589
  exports.SignUpSubmitPasswordError = SignUpSubmitPasswordError;
27147
27590
  exports.SignUpSubmitPasswordResult = SignUpSubmitPasswordResult;
27148
- exports.SubmitAttributesErrorV2 = SubmitAttributesErrorV2;
27149
- exports.SubmitNewPasswordErrorV2 = SubmitNewPasswordErrorV2;
27150
- exports.SubmitPasswordErrorV2 = SubmitPasswordErrorV2;
27151
27591
  exports.UnexpectedError = UnexpectedError;
27152
27592
  exports.UnsupportedEnvironmentError = UnsupportedEnvironmentError;
27153
27593
  exports.UserAccountAttributeError = UserAccountAttributeError;
27154
27594
  exports.UserAlreadySignedInError = UserAlreadySignedInError;
27155
- exports.VerifyChallengeErrorV2 = VerifyChallengeErrorV2;
27156
27595
  //# sourceMappingURL=msal-custom-auth.cjs.map