@azure/msal-browser 5.28.0 → 5.29.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 (501) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  4. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
  7. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +1 -1
  8. package/dist/cache/AccountManager.mjs +1 -1
  9. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  10. package/dist/cache/BrowserCacheManager.mjs +1 -1
  11. package/dist/cache/CacheHelpers.mjs +1 -1
  12. package/dist/cache/CacheKeys.mjs +1 -1
  13. package/dist/cache/CookieStorage.mjs +1 -1
  14. package/dist/cache/DatabaseStorage.mjs +1 -1
  15. package/dist/cache/EncryptedData.mjs +1 -1
  16. package/dist/cache/LocalStorage.mjs +1 -1
  17. package/dist/cache/MemoryStorage.mjs +1 -1
  18. package/dist/cache/SessionStorage.mjs +1 -1
  19. package/dist/cache/TokenCache.mjs +1 -1
  20. package/dist/config/Configuration.mjs +1 -1
  21. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  22. package/dist/controllers/StandardController.mjs +1 -1
  23. package/dist/crypto/BrowserCrypto.mjs +1 -1
  24. package/dist/crypto/CryptoOps.mjs +1 -1
  25. package/dist/crypto/PkceGenerator.mjs +1 -1
  26. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  27. package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
  28. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  29. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +6 -4
  30. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
  31. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +58 -62
  32. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  33. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  34. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  35. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  36. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  37. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  38. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  39. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +3 -5
  51. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -1
  52. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +19 -13
  53. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -1
  54. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +8 -2
  55. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -1
  56. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +58 -69
  57. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs.map +1 -1
  58. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +3 -3
  59. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +42 -15
  60. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  61. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +17 -4
  62. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -1
  63. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +1 -1
  64. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -18
  65. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  66. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +2 -4
  67. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -1
  68. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +2 -3
  69. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -1
  70. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +17 -6
  71. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  72. package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs +110 -0
  73. package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
  74. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  75. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  76. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  77. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  78. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +2 -1
  79. package/dist/custom_auth/core/error/InvalidArgumentError.mjs.map +1 -1
  80. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  81. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  82. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  83. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  84. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  85. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  86. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  87. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  88. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  89. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  90. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  91. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  92. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  93. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  94. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  95. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  96. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  97. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +256 -150
  98. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  99. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +2 -6
  100. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -1
  101. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -3
  102. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  109. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  110. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  111. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  112. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +1 -7
  113. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  114. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
  115. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +35 -19
  116. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
  117. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  119. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +20 -9
  120. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
  122. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +1 -1
  123. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
  124. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +1 -2
  125. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
  126. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  127. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  128. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +5 -7
  129. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
  130. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +3 -2
  131. package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
  132. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +17 -2
  133. package/dist/custom_auth/core/utils/ArgumentValidator.mjs.map +1 -1
  134. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  135. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  136. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  137. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  138. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  139. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  140. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  141. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  142. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  143. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  144. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  145. package/dist/custom_auth/index.mjs +4 -3
  146. package/dist/custom_auth/index.mjs.map +1 -1
  147. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  148. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  149. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  150. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  151. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  152. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  153. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  154. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  155. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  156. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  157. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  158. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +23 -7
  159. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  160. package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs +24 -0
  161. package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs.map +1 -0
  162. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  163. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  164. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  165. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  166. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  167. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  168. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  169. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  170. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  171. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  172. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  173. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  174. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  175. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +4 -7
  176. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -1
  177. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +2 -2
  178. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs.map +1 -1
  179. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  180. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  181. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  182. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  183. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  184. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  185. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  186. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  187. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  188. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  189. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  190. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  191. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  193. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +17 -8
  194. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -1
  195. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs +78 -0
  196. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs.map +1 -0
  197. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs +48 -0
  198. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs.map +1 -0
  199. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs +49 -0
  200. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs.map +1 -0
  201. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +17 -24
  202. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
  203. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  204. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  205. package/dist/encode/Base64Decode.mjs +1 -1
  206. package/dist/encode/Base64Encode.mjs +1 -1
  207. package/dist/error/BrowserAuthError.mjs +1 -1
  208. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  209. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  210. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  211. package/dist/error/NativeAuthError.mjs +1 -1
  212. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  213. package/dist/error/NestedAppAuthError.mjs +1 -1
  214. package/dist/event/EventHandler.mjs +1 -1
  215. package/dist/event/EventMessage.mjs +1 -1
  216. package/dist/event/EventType.mjs +1 -1
  217. package/dist/index.mjs +1 -1
  218. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  219. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  220. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +38 -31
  221. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  222. package/dist/interaction_client/PopupClient.mjs +1 -1
  223. package/dist/interaction_client/RedirectClient.mjs +1 -1
  224. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  225. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  226. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  227. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  228. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  229. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  230. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  231. package/dist/log-strings-mapping.json +21 -9
  232. package/dist/naa/BridgeError.mjs +1 -1
  233. package/dist/naa/BridgeProxy.mjs +1 -1
  234. package/dist/naa/BridgeStatusCode.mjs +1 -1
  235. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  236. package/dist/navigation/NavigationClient.mjs +1 -1
  237. package/dist/network/FetchClient.mjs +1 -1
  238. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  239. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  240. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  241. package/dist/packageMetadata.mjs +2 -2
  242. package/dist/popup_relay/constants.mjs +1 -1
  243. package/dist/popup_relay/index.mjs +1 -1
  244. package/dist/popup_relay/relayClient.mjs +1 -1
  245. package/dist/protocol/Authorize.mjs +1 -1
  246. package/dist/redirect_bridge/index.mjs +1 -1
  247. package/dist/request/RequestHelpers.mjs +1 -1
  248. package/dist/request/SilentRequestHelpers.mjs +1 -1
  249. package/dist/response/ResponseHandler.mjs +1 -1
  250. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  251. package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
  252. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  253. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  254. package/dist/utils/BrowserConstants.mjs +1 -1
  255. package/dist/utils/BrowserDetection.mjs +1 -1
  256. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  257. package/dist/utils/BrowserUtils.mjs +1 -1
  258. package/dist/utils/Helpers.mjs +1 -1
  259. package/dist/utils/IframeMonitor.mjs +1 -1
  260. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  261. package/dist/utils/PopupMonitor.mjs +1 -1
  262. package/dist/utils/PopupOriginCheck.mjs +1 -1
  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 +21 -9
  270. package/lib/custom-auth-path/msal-custom-auth.cjs +1100 -765
  271. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  272. package/lib/custom-auth-path/msal-custom-auth.js +1100 -765
  273. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  274. package/lib/log-strings-mapping.json +7 -3
  275. package/lib/msal-browser.cjs +117 -107
  276. package/lib/msal-browser.cjs.map +1 -1
  277. package/lib/msal-browser.js +117 -107
  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/custom_auth/CustomAuthActionInputs.ts +12 -5
  293. package/src/custom_auth/CustomAuthPublicClientApplication.ts +5 -3
  294. package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +5 -3
  295. package/src/custom_auth/controller/CustomAuthStandardController.ts +79 -110
  296. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +1 -2
  297. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +1 -4
  298. package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +5 -4
  299. package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +28 -16
  300. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +6 -0
  301. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.ts +83 -72
  302. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +3 -3
  303. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +7 -5
  304. package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +10 -6
  305. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +9 -6
  306. package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +4 -6
  307. package/src/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.ts +36 -0
  308. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +6 -8
  309. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +2 -2
  310. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +61 -12
  311. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +21 -3
  312. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +30 -24
  313. package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +1 -3
  314. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +11 -2
  315. package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +1 -2
  316. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +26 -7
  317. package/src/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.ts +179 -0
  318. package/src/custom_auth/core/error/InvalidArgumentError.ts +1 -1
  319. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +12 -12
  320. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +394 -238
  321. package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +2 -6
  322. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +2 -15
  323. package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +63 -26
  324. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +0 -6
  325. package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +74 -26
  326. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +48 -9
  327. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +4 -6
  328. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +0 -6
  329. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +14 -53
  330. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +0 -18
  331. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +32 -13
  332. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +8 -9
  333. package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +4 -5
  334. package/src/custom_auth/core/telemetry/PublicApiId.ts +1 -0
  335. package/src/custom_auth/core/utils/ArgumentValidator.ts +26 -0
  336. package/src/custom_auth/index.ts +10 -11
  337. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
  338. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +28 -5
  339. package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.ts +30 -0
  340. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +4 -8
  341. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +4 -7
  342. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +3 -6
  343. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +0 -3
  344. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.ts +2 -3
  345. package/src/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.ts +49 -0
  346. package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +8 -4
  347. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +16 -4
  348. package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +26 -5
  349. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.ts +101 -0
  350. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.ts +53 -0
  351. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.ts +97 -0
  352. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +0 -6
  353. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +25 -48
  354. package/src/interaction_client/PlatformAuthInteractionClient.ts +53 -38
  355. package/src/packageMetadata.ts +1 -1
  356. package/types/custom_auth/CustomAuthActionInputs.d.ts +12 -5
  357. package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
  358. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  359. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts +5 -3
  360. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
  361. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +5 -3
  362. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -1
  363. package/types/custom_auth/controller/CustomAuthStandardController.d.ts +2 -0
  364. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  365. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +1 -2
  366. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -1
  367. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +1 -4
  368. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -1
  369. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +5 -4
  370. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -1
  371. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +17 -8
  372. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -1
  373. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +6 -0
  374. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -1
  375. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts +23 -44
  376. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts.map +1 -1
  377. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +3 -3
  378. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +7 -6
  379. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -1
  380. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +7 -6
  381. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -1
  382. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +8 -7
  383. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -1
  384. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +4 -6
  385. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -1
  386. package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +20 -0
  387. package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
  388. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +6 -8
  389. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  390. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +2 -2
  391. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +3 -6
  392. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  393. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +3 -3
  394. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -1
  395. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +6 -8
  396. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  397. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +1 -3
  398. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -1
  399. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -2
  400. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  401. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +1 -2
  402. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -1
  403. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +5 -6
  404. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  405. package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +23 -0
  406. package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
  407. package/types/custom_auth/core/error/InvalidArgumentError.d.ts +1 -0
  408. package/types/custom_auth/core/error/InvalidArgumentError.d.ts.map +1 -1
  409. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +8 -1
  410. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  411. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -10
  412. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  413. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +1 -1
  414. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -1
  415. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +2 -5
  416. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  417. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +22 -3
  418. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
  419. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  420. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
  421. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +2 -1
  422. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  423. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +1 -1
  424. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  425. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -1
  426. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +8 -8
  427. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  428. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
  429. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +18 -6
  430. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
  431. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +6 -10
  432. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
  433. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +0 -4
  434. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
  435. package/types/custom_auth/core/telemetry/PublicApiId.d.ts +1 -0
  436. package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
  437. package/types/custom_auth/core/utils/ArgumentValidator.d.ts +3 -0
  438. package/types/custom_auth/core/utils/ArgumentValidator.d.ts.map +1 -1
  439. package/types/custom_auth/index.d.ts +5 -5
  440. package/types/custom_auth/index.d.ts.map +1 -1
  441. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
  442. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  443. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +7 -5
  444. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  445. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts +7 -0
  446. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts.map +1 -0
  447. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +4 -8
  448. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -1
  449. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +5 -6
  450. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  451. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +3 -6
  452. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -1
  453. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +0 -1
  454. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -1
  455. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts +3 -2
  456. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts.map +1 -1
  457. package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts +27 -0
  458. package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts.map +1 -0
  459. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +6 -3
  460. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -1
  461. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +12 -3
  462. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  463. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +8 -3
  464. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -1
  465. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts +24 -0
  466. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts.map +1 -0
  467. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts +18 -0
  468. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts.map +1 -0
  469. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts +7 -0
  470. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts.map +1 -0
  471. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +0 -4
  472. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -1
  473. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +5 -4
  474. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
  475. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +4 -3
  476. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  477. package/types/packageMetadata.d.ts +1 -1
  478. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +0 -82
  479. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +0 -1
  480. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +0 -25
  481. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +0 -1
  482. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +0 -45
  483. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +0 -1
  484. package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +0 -23
  485. package/src/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.ts +0 -19
  486. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +0 -22
  487. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +0 -115
  488. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +0 -34
  489. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +0 -61
  490. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +0 -14
  491. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +0 -1
  492. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts +0 -13
  493. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts.map +0 -1
  494. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +0 -9
  495. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +0 -1
  496. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +0 -17
  497. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +0 -1
  498. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +0 -11
  499. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +0 -1
  500. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +0 -19
  501. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v5.28.0 2026-11-05 */
1
+ /*! @azure/msal-browser v5.29.0 2026-11-06 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -62,7 +62,7 @@ const ATTRIBUTE_TOKENS = "attribute_tokens";
62
62
  */
63
63
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
64
64
 
65
- /*! @azure/msal-common v16.16.0 2026-11-05 */
65
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
66
66
  /*
67
67
  * Copyright (c) Microsoft Corporation. All rights reserved.
68
68
  * Licensed under the MIT License.
@@ -296,7 +296,7 @@ const JsonWebTokenTypes = {
296
296
  // Token renewal offset default in seconds
297
297
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
298
298
 
299
- /*! @azure/msal-common v16.16.0 2026-11-05 */
299
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
300
300
  /*
301
301
  * Copyright (c) Microsoft Corporation. All rights reserved.
302
302
  * Licensed under the MIT License.
@@ -325,7 +325,7 @@ function createAuthError(code, correlationId, additionalMessage) {
325
325
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
326
326
  }
327
327
 
328
- /*! @azure/msal-common v16.16.0 2026-11-05 */
328
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
329
329
 
330
330
  /*
331
331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -348,7 +348,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
348
348
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
349
349
  }
350
350
 
351
- /*! @azure/msal-common v16.16.0 2026-11-05 */
351
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
352
352
  /*
353
353
  * Copyright (c) Microsoft Corporation. All rights reserved.
354
354
  * Licensed under the MIT License.
@@ -386,7 +386,7 @@ const methodNotImplemented = "method_not_implemented";
386
386
  const resourceParameterRequired = "resource_parameter_required";
387
387
  const misplacedResourceParam = "misplaced_resource_parameter";
388
388
 
389
- /*! @azure/msal-common v16.16.0 2026-11-05 */
389
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
390
390
 
391
391
  /*
392
392
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -424,7 +424,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
424
424
  };
425
425
  }
426
426
 
427
- /*! @azure/msal-common v16.16.0 2026-11-05 */
427
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
428
428
 
429
429
  /*
430
430
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -490,7 +490,7 @@ function getJWSPayload(authToken, correlationId) {
490
490
  return matches[2];
491
491
  }
492
492
 
493
- /*! @azure/msal-common v16.16.0 2026-11-05 */
493
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
494
494
 
495
495
  /*
496
496
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -578,7 +578,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
578
578
  return updatedAccountInfo;
579
579
  }
580
580
 
581
- /*! @azure/msal-common v16.16.0 2026-11-05 */
581
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
582
582
  /*
583
583
  * Copyright (c) Microsoft Corporation. All rights reserved.
584
584
  * Licensed under the MIT License.
@@ -592,7 +592,7 @@ const AuthorityType = {
592
592
  Ciam: 3,
593
593
  };
594
594
 
595
- /*! @azure/msal-common v16.16.0 2026-11-05 */
595
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
596
596
  /*
597
597
  * Copyright (c) Microsoft Corporation. All rights reserved.
598
598
  * Licensed under the MIT License.
@@ -614,7 +614,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
614
614
  return null;
615
615
  }
616
616
 
617
- /*! @azure/msal-common v16.16.0 2026-11-05 */
617
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
618
618
  /*
619
619
  * Copyright (c) Microsoft Corporation. All rights reserved.
620
620
  * Licensed under the MIT License.
@@ -638,7 +638,7 @@ const ProtocolMode = {
638
638
  EAR: "EAR",
639
639
  };
640
640
 
641
- /*! @azure/msal-common v16.16.0 2026-11-05 */
641
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
642
642
  /**
643
643
  * Returns the AccountInfo interface for this account.
644
644
  * @internal
@@ -827,7 +827,7 @@ function isAccountEntity(entity) {
827
827
  entity.hasOwnProperty("authorityType"));
828
828
  }
829
829
 
830
- /*! @azure/msal-common v16.16.0 2026-11-05 */
830
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
831
831
  /*
832
832
  * Copyright (c) Microsoft Corporation. All rights reserved.
833
833
  * Licensed under the MIT License.
@@ -837,7 +837,7 @@ function isAccountEntity(entity) {
837
837
  */
838
838
  const unexpectedError = "unexpected_error";
839
839
 
840
- /*! @azure/msal-common v16.16.0 2026-11-05 */
840
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
841
841
 
842
842
  /*
843
843
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -857,7 +857,7 @@ function createClientConfigurationError(errorCode, correlationId) {
857
857
  return new ClientConfigurationError(errorCode, correlationId);
858
858
  }
859
859
 
860
- /*! @azure/msal-common v16.16.0 2026-11-05 */
860
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
861
861
  /*
862
862
  * Copyright (c) Microsoft Corporation. All rights reserved.
863
863
  * Licensed under the MIT License.
@@ -897,7 +897,7 @@ function getResponseHeader(headers, name) {
897
897
  return headerName === undefined ? undefined : headers[headerName];
898
898
  }
899
899
 
900
- /*! @azure/msal-common v16.16.0 2026-11-05 */
900
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
901
901
  /*
902
902
  * Copyright (c) Microsoft Corporation. All rights reserved.
903
903
  * Licensed under the MIT License.
@@ -928,7 +928,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
928
928
  const invalidDpopNonce = "invalid_dpop_nonce";
929
929
  const dpopMissingResourceContext = "dpop_missing_resource_context";
930
930
 
931
- /*! @azure/msal-common v16.16.0 2026-11-05 */
931
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
932
932
  /*
933
933
  * Copyright (c) Microsoft Corporation. All rights reserved.
934
934
  * Licensed under the MIT License.
@@ -940,7 +940,7 @@ function isOpenIdConfigResponse(response) {
940
940
  response.hasOwnProperty("jwks_uri"));
941
941
  }
942
942
 
943
- /*! @azure/msal-common v16.16.0 2026-11-05 */
943
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
944
944
  /*
945
945
  * Copyright (c) Microsoft Corporation. All rights reserved.
946
946
  * Licensed under the MIT License.
@@ -1020,7 +1020,7 @@ class StringUtils {
1020
1020
  }
1021
1021
  }
1022
1022
 
1023
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1023
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1024
1024
 
1025
1025
  /*
1026
1026
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1178,7 +1178,7 @@ class UrlString {
1178
1178
  }
1179
1179
  }
1180
1180
 
1181
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1181
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1182
1182
 
1183
1183
  /*
1184
1184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1332,7 +1332,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1332
1332
  return null;
1333
1333
  }
1334
1334
 
1335
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1335
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1336
1336
  /*
1337
1337
  * Copyright (c) Microsoft Corporation. All rights reserved.
1338
1338
  * Licensed under the MIT License.
@@ -1341,7 +1341,7 @@ const AzureCloudInstance = {
1341
1341
  // AzureCloudInstance is not specified.
1342
1342
  None: "none"};
1343
1343
 
1344
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1344
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1345
1345
  /*
1346
1346
  * Copyright (c) Microsoft Corporation. All rights reserved.
1347
1347
  * Licensed under the MIT License.
@@ -1351,7 +1351,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1351
1351
  response.hasOwnProperty("metadata"));
1352
1352
  }
1353
1353
 
1354
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1354
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1355
1355
  /*
1356
1356
  * Copyright (c) Microsoft Corporation. All rights reserved.
1357
1357
  * Licensed under the MIT License.
@@ -1361,7 +1361,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1361
1361
  response.hasOwnProperty("error_description"));
1362
1362
  }
1363
1363
 
1364
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1364
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1365
1365
  /*
1366
1366
  * Copyright (c) Microsoft Corporation. All rights reserved.
1367
1367
  * Licensed under the MIT License.
@@ -1432,7 +1432,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1432
1432
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1433
1433
  const SetUserData = "setUserData";
1434
1434
 
1435
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1435
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1436
1436
  /*
1437
1437
  * Copyright (c) Microsoft Corporation. All rights reserved.
1438
1438
  * Licensed under the MIT License.
@@ -1525,7 +1525,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1525
1525
  };
1526
1526
  };
1527
1527
 
1528
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1528
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1529
1529
 
1530
1530
  /*
1531
1531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1636,7 +1636,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1636
1636
  },
1637
1637
  };
1638
1638
 
1639
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1639
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1640
1640
  /*
1641
1641
  * Copyright (c) Microsoft Corporation. All rights reserved.
1642
1642
  * Licensed under the MIT License.
@@ -1701,7 +1701,7 @@ function wasClockTurnedBack(cachedAt) {
1701
1701
  return cachedAtSec > nowSeconds();
1702
1702
  }
1703
1703
 
1704
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1704
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1705
1705
 
1706
1706
  /*
1707
1707
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1988,7 +1988,7 @@ function serializeAttributeTokens(attributeTokens) {
1988
1988
  return [...attributeTokens].sort().join(" ");
1989
1989
  }
1990
1990
 
1991
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1991
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1992
1992
 
1993
1993
  /*
1994
1994
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2956,7 +2956,7 @@ function buildStaticAuthorityOptions(authOptions) {
2956
2956
  };
2957
2957
  }
2958
2958
 
2959
- /*! @azure/msal-common v16.16.0 2026-11-05 */
2959
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
2960
2960
 
2961
2961
  /*
2962
2962
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2990,7 +2990,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
2990
2990
  }
2991
2991
  }
2992
2992
 
2993
- /*! @azure/msal-common v16.16.0 2026-11-05 */
2993
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
2994
2994
 
2995
2995
  /*
2996
2996
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3186,7 +3186,7 @@ class ScopeSet {
3186
3186
  }
3187
3187
  }
3188
3188
 
3189
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3189
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3190
3190
 
3191
3191
  /*
3192
3192
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3686,7 +3686,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3686
3686
  }
3687
3687
  }
3688
3688
 
3689
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3689
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3690
3690
 
3691
3691
  /*
3692
3692
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3817,7 +3817,7 @@ function validateUrl(url, logger, correlationId) {
3817
3817
  }
3818
3818
  }
3819
3819
 
3820
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3820
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3821
3821
 
3822
3822
  /*
3823
3823
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3865,7 +3865,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3865
3865
  },
3866
3866
  };
3867
3867
 
3868
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3868
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3869
3869
 
3870
3870
  /*
3871
3871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3888,7 +3888,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3888
3888
  },
3889
3889
  };
3890
3890
 
3891
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3891
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3892
3892
  /*
3893
3893
  * Copyright (c) Microsoft Corporation. All rights reserved.
3894
3894
  * Licensed under the MIT License.
@@ -4163,12 +4163,12 @@ class Logger {
4163
4163
  }
4164
4164
  }
4165
4165
 
4166
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4166
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4167
4167
  /* eslint-disable header/header */
4168
4168
  const name$1 = "@azure/msal-common";
4169
- const version$1 = "16.16.0";
4169
+ const version$1 = "16.16.1";
4170
4170
 
4171
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4171
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4172
4172
  /*
4173
4173
  * Copyright (c) Microsoft Corporation. All rights reserved.
4174
4174
  * Licensed under the MIT License.
@@ -4176,7 +4176,7 @@ const version$1 = "16.16.0";
4176
4176
  const cacheQuotaExceeded = "cache_quota_exceeded";
4177
4177
  const cacheErrorUnknown = "cache_error_unknown";
4178
4178
 
4179
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4179
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4180
4180
 
4181
4181
  /*
4182
4182
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4214,7 +4214,7 @@ function createCacheError(e) {
4214
4214
  }
4215
4215
  }
4216
4216
 
4217
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4217
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4218
4218
 
4219
4219
  /*
4220
4220
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4678,19 +4678,25 @@ class CacheManager {
4678
4678
  * @param account
4679
4679
  */
4680
4680
  removeAccount(account, correlationId) {
4681
- this.removeAccountContext(account, correlationId);
4682
4681
  const accountKeys = this.getAccountKeys();
4683
4682
  const keyFilter = (key) => {
4684
4683
  return (key.includes(account.homeAccountId) &&
4685
4684
  key.includes(account.environment));
4686
4685
  };
4686
+ this.getTokenKeys()
4687
+ .idToken.filter(keyFilter)
4688
+ .forEach((key) => {
4689
+ this.removeIdToken(key, correlationId);
4690
+ });
4691
+ this.removeAccountContext(account, correlationId);
4687
4692
  accountKeys.filter(keyFilter).forEach((key) => {
4688
4693
  this.removeItem(key, correlationId);
4689
4694
  this.performanceClient.incrementFields({ accountsRemoved: 1 }, correlationId);
4690
4695
  });
4691
4696
  }
4692
4697
  /**
4693
- * Removes credentials associated with the provided account
4698
+ * Removes access and refresh tokens associated with the provided account,
4699
+ * preserving the account and its ID tokens.
4694
4700
  * @param account
4695
4701
  */
4696
4702
  removeAccountContext(account, correlationId) {
@@ -4699,9 +4705,6 @@ class CacheManager {
4699
4705
  return (key.includes(account.homeAccountId) &&
4700
4706
  key.includes(account.environment));
4701
4707
  };
4702
- allTokenKeys.idToken.filter(keyFilter).forEach((key) => {
4703
- this.removeIdToken(key, correlationId);
4704
- });
4705
4708
  allTokenKeys.accessToken.filter(keyFilter).forEach((key) => {
4706
4709
  this.removeAccessToken(key, correlationId);
4707
4710
  });
@@ -5438,7 +5441,7 @@ class DefaultStorageClass extends CacheManager {
5438
5441
  }
5439
5442
  }
5440
5443
 
5441
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5444
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5442
5445
  /*
5443
5446
  * Copyright (c) Microsoft Corporation. All rights reserved.
5444
5447
  * Licensed under the MIT License.
@@ -5452,7 +5455,7 @@ class DefaultStorageClass extends CacheManager {
5452
5455
  const PerformanceEventStatus = {
5453
5456
  InProgress: 1};
5454
5457
 
5455
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5458
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5456
5459
 
5457
5460
  /*
5458
5461
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5510,7 +5513,7 @@ class StubPerformanceClient {
5510
5513
  }
5511
5514
  }
5512
5515
 
5513
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5516
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5514
5517
 
5515
5518
  /*
5516
5519
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5608,7 +5611,7 @@ function isOidcProtocolMode(config) {
5608
5611
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5609
5612
  }
5610
5613
 
5611
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5614
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5612
5615
  /*
5613
5616
  * Copyright (c) Microsoft Corporation. All rights reserved.
5614
5617
  * Licensed under the MIT License.
@@ -5635,7 +5638,7 @@ function isOidcProtocolMode(config) {
5635
5638
  }
5636
5639
  }
5637
5640
 
5638
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5641
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5639
5642
 
5640
5643
  /*
5641
5644
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5656,7 +5659,7 @@ function createJoseHeaderError(code, correlationId) {
5656
5659
  return new JoseHeaderError(code, correlationId);
5657
5660
  }
5658
5661
 
5659
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5662
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5660
5663
  /*
5661
5664
  * Copyright (c) Microsoft Corporation. All rights reserved.
5662
5665
  * Licensed under the MIT License.
@@ -5681,7 +5684,7 @@ function isPlainObject(value) {
5681
5684
  return Object.getPrototypeOf(value) === proto;
5682
5685
  }
5683
5686
 
5684
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5687
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5685
5688
  /*
5686
5689
  * Copyright (c) Microsoft Corporation. All rights reserved.
5687
5690
  * Licensed under the MIT License.
@@ -5691,7 +5694,7 @@ const missingAlgError = "missing_alg_error";
5691
5694
  const missingJwkError = "missing_jwk_error";
5692
5695
  const invalidJwkError = "invalid_jwk_error";
5693
5696
 
5694
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5697
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5695
5698
 
5696
5699
  /*
5697
5700
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5757,7 +5760,7 @@ class JoseHeader {
5757
5760
  }
5758
5761
  }
5759
5762
 
5760
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5763
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5761
5764
 
5762
5765
  /*
5763
5766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5858,7 +5861,7 @@ class PopTokenGenerator {
5858
5861
  }
5859
5862
  }
5860
5863
 
5861
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5864
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5862
5865
 
5863
5866
  /*
5864
5867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6013,7 +6016,7 @@ class DpopProofGenerator {
6013
6016
  }
6014
6017
  }
6015
6018
 
6016
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6019
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6017
6020
  /*
6018
6021
  * Copyright (c) Microsoft Corporation. All rights reserved.
6019
6022
  * Licensed under the MIT License.
@@ -6064,7 +6067,7 @@ const badToken = "bad_token";
6064
6067
  */
6065
6068
  const interruptedUser = "interrupted_user";
6066
6069
 
6067
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6070
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6068
6071
 
6069
6072
  /*
6070
6073
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6131,7 +6134,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6131
6134
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6132
6135
  }
6133
6136
 
6134
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6137
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6135
6138
 
6136
6139
  /*
6137
6140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6150,7 +6153,7 @@ class ServerError extends AuthError {
6150
6153
  }
6151
6154
  }
6152
6155
 
6153
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6156
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6154
6157
 
6155
6158
  /*
6156
6159
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6221,7 +6224,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6221
6224
  }
6222
6225
  }
6223
6226
 
6224
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6227
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6225
6228
 
6226
6229
  /*
6227
6230
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6649,7 +6652,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6649
6652
  return baseAccount;
6650
6653
  }
6651
6654
 
6652
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6655
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6653
6656
  /*
6654
6657
  * Copyright (c) Microsoft Corporation. All rights reserved.
6655
6658
  * Licensed under the MIT License.
@@ -6659,7 +6662,7 @@ const CcsCredentialType = {
6659
6662
  UPN: "UPN",
6660
6663
  };
6661
6664
 
6662
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6665
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6663
6666
  /*
6664
6667
  * Copyright (c) Microsoft Corporation. All rights reserved.
6665
6668
  * Licensed under the MIT License.
@@ -6678,7 +6681,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6678
6681
  }
6679
6682
  }
6680
6683
 
6681
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6684
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6682
6685
 
6683
6686
  /*
6684
6687
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6702,7 +6705,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6702
6705
  };
6703
6706
  }
6704
6707
 
6705
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6708
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6706
6709
 
6707
6710
  /*
6708
6711
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6792,7 +6795,7 @@ function getRetryAfterHeader(response) {
6792
6795
  return undefined;
6793
6796
  }
6794
6797
 
6795
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6798
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6796
6799
 
6797
6800
  /*
6798
6801
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6823,7 +6826,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6823
6826
  return new NetworkError(error, httpStatus, responseHeaders);
6824
6827
  }
6825
6828
 
6826
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6829
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6827
6830
 
6828
6831
  /*
6829
6832
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6957,7 +6960,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6957
6960
  return response;
6958
6961
  }
6959
6962
 
6960
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6963
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6961
6964
 
6962
6965
  /*
6963
6966
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7224,7 +7227,7 @@ class AuthorizationCodeClient {
7224
7227
  }
7225
7228
  }
7226
7229
 
7227
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7230
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7228
7231
 
7229
7232
  /*
7230
7233
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7454,7 +7457,7 @@ function extractLoginHint(account) {
7454
7457
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7455
7458
  }
7456
7459
 
7457
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7460
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7458
7461
 
7459
7462
  /*
7460
7463
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7689,7 +7692,7 @@ class RefreshTokenClient {
7689
7692
  }
7690
7693
  }
7691
7694
 
7692
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7695
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7693
7696
 
7694
7697
  /*
7695
7698
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7982,7 +7985,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
7982
7985
  clearNativeBrokerErrorCode() { }
7983
7986
  }
7984
7987
 
7985
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7988
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7986
7989
 
7987
7990
  /*
7988
7991
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8109,7 +8112,7 @@ class SilentFlowClient {
8109
8112
  }
8110
8113
  }
8111
8114
 
8112
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8115
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
8113
8116
 
8114
8117
  /*
8115
8118
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8125,7 +8128,7 @@ const StubbedNetworkModule = {
8125
8128
  },
8126
8129
  };
8127
8130
 
8128
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8131
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
8129
8132
 
8130
8133
  /*
8131
8134
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8311,6 +8314,7 @@ class InvalidArgumentError extends CustomAuthError {
8311
8314
  constructor(argName, correlationId) {
8312
8315
  const errorDescription = `The argument '${argName}' is invalid.`;
8313
8316
  super("invalid_argument", errorDescription, correlationId);
8317
+ this.argName = argName;
8314
8318
  Object.setPrototypeOf(this, InvalidArgumentError.prototype);
8315
8319
  }
8316
8320
  }
@@ -8346,11 +8350,11 @@ const ACCESS_DENIED = "access_denied";
8346
8350
  * Licensed under the MIT License.
8347
8351
  */
8348
8352
  const PASSWORD_TOO_WEAK$1 = "password_too_weak";
8349
- const PASSWORD_TOO_SHORT = "password_too_short";
8350
- const PASSWORD_TOO_LONG = "password_too_long";
8351
- const PASSWORD_RECENTLY_USED = "password_recently_used";
8352
- const PASSWORD_BANNED = "password_banned";
8353
- const PASSWORD_IS_INVALID = "password_is_invalid";
8353
+ const PASSWORD_TOO_SHORT$1 = "password_too_short";
8354
+ const PASSWORD_TOO_LONG$1 = "password_too_long";
8355
+ const PASSWORD_RECENTLY_USED$1 = "password_recently_used";
8356
+ const PASSWORD_BANNED$1 = "password_banned";
8357
+ const PASSWORD_IS_INVALID$1 = "password_is_invalid";
8354
8358
  const INVALID_OOB_VALUE = "invalid_oob_value";
8355
8359
  const ATTRIBUTE_VALIATION_FAILED = "attribute_validation_failed";
8356
8360
  const REGISTRATION_REQUIRED = "registration_required";
@@ -8408,11 +8412,11 @@ class AuthFlowErrorBase {
8408
8412
  }
8409
8413
  isInvalidNewPasswordError() {
8410
8414
  const invalidPasswordSubErrors = new Set([
8411
- PASSWORD_BANNED,
8412
- PASSWORD_IS_INVALID,
8413
- PASSWORD_RECENTLY_USED,
8414
- PASSWORD_TOO_LONG,
8415
- PASSWORD_TOO_SHORT,
8415
+ PASSWORD_BANNED$1,
8416
+ PASSWORD_IS_INVALID$1,
8417
+ PASSWORD_RECENTLY_USED$1,
8418
+ PASSWORD_TOO_LONG$1,
8419
+ PASSWORD_TOO_SHORT$1,
8416
8420
  PASSWORD_TOO_WEAK$1,
8417
8421
  ]);
8418
8422
  return (this.errorData instanceof CustomAuthApiError &&
@@ -8557,11 +8561,26 @@ function ensureArgumentIsStringArray(argName, argValue, correlationId) {
8557
8561
  !argValue.every((value) => typeof value === "string")) {
8558
8562
  throw new InvalidArgumentError(argName, correlationId);
8559
8563
  }
8564
+ }
8565
+ function filterReservedSignUpAttributesV2(attributes, logger, correlationId) {
8566
+ const reservedSignUpAttributeNames = new Set(["email", "password"]);
8567
+ const reservedSignUpAttributeWarning = "Ignoring app-supplied sign-up attribute because it uses a reserved SDK attribute name.";
8568
+ const filteredAttributes = [];
8569
+ for (const [attributeId, value] of Object.entries(attributes ?? {})) {
8570
+ if (reservedSignUpAttributeNames.has(attributeId.toLowerCase())) {
8571
+ logger.warning(reservedSignUpAttributeWarning, correlationId);
8572
+ continue;
8573
+ }
8574
+ if (value !== undefined) {
8575
+ filteredAttributes.push([attributeId, value]);
8576
+ }
8577
+ }
8578
+ return Object.fromEntries(filteredAttributes);
8560
8579
  }
8561
8580
 
8562
8581
  /* eslint-disable header/header */
8563
8582
  const name = "@azure/msal-browser";
8564
- const version = "5.28.0";
8583
+ const version = "5.29.0";
8565
8584
 
8566
8585
  /*
8567
8586
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11709,6 +11728,7 @@ const SIGN_IN_V2_COMPLETE = 100209;
11709
11728
  const SIGN_IN_V2_SUBMIT_CODE = 100210;
11710
11729
  const SIGN_UP_V2_START = 100211;
11711
11730
  const SIGN_UP_V2_CHALLENGE = 100212;
11731
+ const SIGN_UP_V2_SUBMIT_PASSWORD = 100223;
11712
11732
  const SIGN_UP_V2_SUBMIT_CODE = 100213;
11713
11733
  const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
11714
11734
  const SIGN_UP_V2_RESEND_CODE = 100215;
@@ -12512,12 +12532,7 @@ function readNumberArray(value) {
12512
12532
  * Licensed under the MIT License.
12513
12533
  */
12514
12534
  /*
12515
- * Turns a raw HTTP response from a V2 endpoint into a typed, checked envelope, and validates HAL
12516
- * relations. Raw-preserving: the body keeps its HAL `_links`/`_embedded` shape so the api-client
12517
- * navigates typed hrefs directly. Parsing never throws on a non-200 status - every V2 response
12518
- * (including the entry response) carries a meaningful body, so only a non-object body is a hard
12519
- * failure; the wire error is normalized onto the envelope (`error`). Required response values use
12520
- * shared guards after callers read their strongly typed response properties directly.
12535
+ * Parses V2 HTTP responses and validates required response values.
12521
12536
  */
12522
12537
  class ResponseHandlerV2 {
12523
12538
  constructor(logger) {
@@ -12535,7 +12550,6 @@ class ResponseHandlerV2 {
12535
12550
  : undefined);
12536
12551
  const error = normalizeServerErrorV2(json);
12537
12552
  const isWebFallbackRequired = error?.subError === WEB_REDIRECT_REQUIRED;
12538
- // Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
12539
12553
  json.correlationId = correlationId;
12540
12554
  return {
12541
12555
  statusCode: response.status,
@@ -12565,6 +12579,24 @@ class ResponseHandlerV2 {
12565
12579
  }
12566
12580
  return continuationToken;
12567
12581
  }
12582
+ resolveSignUpAttributes(attributes, correlationId) {
12583
+ const resolved = attributes === undefined ? [] : attributes;
12584
+ if (!Array.isArray(resolved) ||
12585
+ resolved.some((attribute) => typeof attribute !== "object" ||
12586
+ attribute === null ||
12587
+ typeof attribute.attributeId !== "string" ||
12588
+ !attribute.attributeId.trim())) {
12589
+ const message = "Invalid HAL response: sign-up attributes must be an array of objects with nonempty string attributeId values";
12590
+ this.logger?.error(message, correlationId);
12591
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
12592
+ }
12593
+ if (resolved.some((attribute) => attribute.attributeId.toLowerCase() === "email")) {
12594
+ const message = "Invalid HAL response: email cannot be collected as a sign-up attribute";
12595
+ this.logger?.error(message, correlationId);
12596
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
12597
+ }
12598
+ return resolved;
12599
+ }
12568
12600
  // Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
12569
12601
  requireMethods(methods, correlationId) {
12570
12602
  if (!methods?.length) {
@@ -12582,7 +12614,6 @@ class ResponseHandlerV2 {
12582
12614
  this.logger?.error("0fc89v", correlationId);
12583
12615
  throw new CustomAuthApiError(INVALID_RESPONSE_BODY, `V2 response body is not valid JSON: '${e}'`, correlationId);
12584
12616
  }
12585
- // response.json() accepts primitives/arrays; every V2 body must be a JSON object.
12586
12617
  if (typeof json !== "object" || json === null || Array.isArray(json)) {
12587
12618
  this.logger?.error("09w4yw", correlationId);
12588
12619
  throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "V2 response body is not a JSON object", correlationId);
@@ -12654,9 +12685,7 @@ function apiPath(path) {
12654
12685
  * Copyright (c) Microsoft Corporation. All rights reserved.
12655
12686
  * Licensed under the MIT License.
12656
12687
  */
12657
- // Content type used by V2 JSON `/api` requests.
12658
12688
  const JSON_CONTENT_TYPE = "application/json";
12659
- // Server action returned after successful credential verification.
12660
12689
  const UPDATE_RELATION = "update";
12661
12690
  const CHALLENGE_RELATION = "challenge";
12662
12691
  const VERIFY_RELATION = "verify";
@@ -12675,10 +12704,6 @@ const AuthenticationMethodTypeV2 = {
12675
12704
  const PhoneRegistrationChannelV2 = {
12676
12705
  SMS: "sms",
12677
12706
  };
12678
- /*
12679
- * Known `state` values on a HAL response. Kept open (the body field is typed as string) because
12680
- * the server may introduce new values; response parsing and flow logic branch on these constants.
12681
- */
12682
12707
  const ResponseStateV2 = {
12683
12708
  CONTINUE: "continue",
12684
12709
  };
@@ -12897,7 +12922,6 @@ const AuthenticationFactorV2 = {
12897
12922
  * Licensed under the MIT License.
12898
12923
  */
12899
12924
  const SignUpSubmitAttributesNextActionV2 = {
12900
- VERIFY: "verify",
12901
12925
  COLLECT_ATTRIBUTES: "collectAttributes",
12902
12926
  CONTINUE: "continue",
12903
12927
  ENROLL: "enroll",
@@ -12909,7 +12933,6 @@ const SignUpSubmitAttributesNextActionV2 = {
12909
12933
  */
12910
12934
  /*
12911
12935
  * Native Auth V2 network client that follows server-provided HAL links.
12912
- * Flow-specific entry methods reuse shared challenge, verification, and token operations.
12913
12936
  */
12914
12937
  class CustomAuthApiClientV2 extends BaseApiClientV2 {
12915
12938
  /*
@@ -12930,15 +12953,30 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12930
12953
  */
12931
12954
  async signUpStart(signUpHref, request, context) {
12932
12955
  const parsedResponse = await this.sendActionRequest(signUpHref, HttpMethod.POST, request, context);
12933
- return {
12934
- continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
12935
- submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", parsedResponse.correlationId),
12936
- attributes: parsedResponse.body.attributes,
12937
- };
12956
+ const challengeType = parsedResponse.body.action === VERIFY_RELATION
12957
+ ? parsedResponse.body.type
12958
+ : undefined;
12959
+ const isEmailChallenge = typeof challengeType === "string" &&
12960
+ challengeType.toLowerCase() === AuthenticationMethodTypeV2.EMAIL;
12961
+ if (parsedResponse.body.action === VERIFY_RELATION &&
12962
+ isEmailChallenge) {
12963
+ return this.toChallengeVerificationResult(parsedResponse);
12964
+ }
12965
+ if (parsedResponse.body.action === CHALLENGE_RELATION) {
12966
+ return {
12967
+ nextAction: CHALLENGE_RELATION,
12968
+ continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
12969
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, parsedResponse.correlationId), parsedResponse.correlationId),
12970
+ authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
12971
+ scenario: parsedResponse.body.scenario,
12972
+ };
12973
+ }
12974
+ const message = "Invalid HAL response: sign-up start did not return an email verification or authentication challenge";
12975
+ this.logger?.error(message, parsedResponse.correlationId);
12976
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, parsedResponse.correlationId);
12938
12977
  }
12939
12978
  /*
12940
- * Submits the initial sign-up attributes. A successful response has already
12941
- * sent the email code and supplies the links needed to verify or resend it.
12979
+ * Submits the initial sign-up attributes.
12942
12980
  */
12943
12981
  async submitSignUpAttributes(submitAttributesHref, request, context) {
12944
12982
  const parsedResponse = await this.sendActionRequest(submitAttributesHref, HttpMethod.POST, request, context);
@@ -12954,16 +12992,10 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12954
12992
  return {
12955
12993
  nextAction: SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES,
12956
12994
  continuationToken,
12957
- attributes: parsedResponse.body.attributes ?? [],
12995
+ attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
12958
12996
  submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
12959
12997
  };
12960
12998
  }
12961
- if (parsedResponse.body.action === VERIFY_RELATION) {
12962
- return {
12963
- ...this.toChallengeVerificationResult(parsedResponse),
12964
- attributes: parsedResponse.body.attributes,
12965
- };
12966
- }
12967
12999
  if (parsedResponse.body.action === ENROLL_RELATION) {
12968
13000
  return {
12969
13001
  nextAction: ENROLL_RELATION,
@@ -13056,7 +13088,15 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
13056
13088
  return {
13057
13089
  nextAction,
13058
13090
  continuationToken,
13059
- enrollmentMethods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13091
+ methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13092
+ };
13093
+ }
13094
+ if (nextAction === CHALLENGE_RELATION) {
13095
+ return {
13096
+ nextAction,
13097
+ continuationToken,
13098
+ authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
13099
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13060
13100
  };
13061
13101
  }
13062
13102
  if (nextAction === POLL_RELATION) {
@@ -13099,7 +13139,7 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
13099
13139
  return {
13100
13140
  nextAction: COLLECT_ATTRIBUTES_RELATION,
13101
13141
  continuationToken,
13102
- attributes: parsedResponse.body.attributes ?? [],
13142
+ attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
13103
13143
  submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
13104
13144
  };
13105
13145
  }
@@ -13225,9 +13265,7 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
13225
13265
  * Licensed under the MIT License.
13226
13266
  */
13227
13267
  /*
13228
- * Shared base for Native Auth V2 interaction clients. It extends
13229
- * `StandardInteractionClient` for common browser infrastructure while keeping
13230
- * V1 and V2 token handling independent.
13268
+ * Shared base for Native Auth V2 interaction clients.
13231
13269
  */
13232
13270
  class InteractionClientBaseV2 extends StandardInteractionClient {
13233
13271
  constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority) {
@@ -13235,13 +13273,11 @@ class InteractionClientBaseV2 extends StandardInteractionClient {
13235
13273
  this.customAuthAuthority = customAuthAuthority;
13236
13274
  this.tokenResponseHandler = new ResponseHandler(this.config.auth.clientId, this.browserStorage, this.browserCrypto, this.logger, this.performanceClient, null, null);
13237
13275
  }
13238
- // Required by the base contract. After sign-in, use CustomAuthAccountData.getAccessToken().
13239
13276
  acquireToken(
13240
13277
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13241
13278
  request) {
13242
13279
  throw new MethodNotImplementedError("InteractionClientBaseV2.acquireToken");
13243
13280
  }
13244
- // Required by the base contract. After sign-in, use CustomAuthAccountData.signOut().
13245
13281
  logout(
13246
13282
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13247
13283
  request) {
@@ -13285,9 +13321,10 @@ class InteractionClientBaseV2 extends StandardInteractionClient {
13285
13321
  * Copyright (c) Microsoft Corporation. All rights reserved.
13286
13322
  * Licensed under the MIT License.
13287
13323
  */
13288
- // Result type discriminators.
13289
13324
  const FLOW_METHOD_SELECTION_REQUIRED_V2 = "FlowMethodSelectionRequiredResultV2";
13290
13325
  const FLOW_CODE_REQUIRED_V2 = "FlowCodeRequiredResultV2";
13326
+ const FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2 = "FlowExistingAccountCodeRequiredResultV2";
13327
+ const FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2 = "FlowExistingAccountPasswordRequiredResultV2";
13291
13328
  const FLOW_PASSWORD_REQUIRED_V2 = "FlowPasswordRequiredResultV2";
13292
13329
  const FLOW_SIGN_UP_PASSWORD_REQUIRED_V2 = "FlowSignUpPasswordRequiredResultV2";
13293
13330
  const FLOW_MFA_REQUIRED_V2 = "FlowMFARequiredResultV2";
@@ -13303,6 +13340,12 @@ function createFlowMethodSelectionRequiredResultV2(input) {
13303
13340
  function createFlowCodeRequiredResultV2(input) {
13304
13341
  return { type: FLOW_CODE_REQUIRED_V2, ...input };
13305
13342
  }
13343
+ function createFlowExistingAccountCodeRequiredResultV2(input) {
13344
+ return { type: FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2, ...input };
13345
+ }
13346
+ function createFlowExistingAccountPasswordRequiredResultV2(input) {
13347
+ return { type: FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2, ...input };
13348
+ }
13306
13349
  function createFlowPasswordRequiredResultV2(input) {
13307
13350
  return { type: FLOW_PASSWORD_REQUIRED_V2, ...input };
13308
13351
  }
@@ -13336,10 +13379,8 @@ function createFlowAuthMethodVerificationRequiredResultV2(input) {
13336
13379
  * Licensed under the MIT License.
13337
13380
  */
13338
13381
  /**
13339
- * The native auth V2 flow that a result or error originates from (sign-in,
13340
- * sign-up, or password reset). It lets a shared result or error type report
13341
- * which entry flow produced it; `Unknown` is used when the flow cannot be
13342
- * determined.
13382
+ * The native auth V2 flow that a result or error originates from.
13383
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
13343
13384
  */
13344
13385
  const CustomAuthFlowScenarioV2 = {
13345
13386
  SignIn: "signIn",
@@ -13370,6 +13411,7 @@ const FLOW_STEP_API_IDS_V2 = {
13370
13411
  [CustomAuthFlowScenarioV2.SignUp]: {
13371
13412
  requestChallenge: SIGN_UP_V2_CHALLENGE,
13372
13413
  submitCode: SIGN_UP_V2_SUBMIT_CODE,
13414
+ submitPassword: SIGN_UP_V2_SUBMIT_PASSWORD,
13373
13415
  resendCode: SIGN_UP_V2_RESEND_CODE,
13374
13416
  submitAttributes: SIGN_UP_V2_SUBMIT_ATTRIBUTES,
13375
13417
  signInWithContinuation: SIGN_UP_V2_COMPLETE,
@@ -13380,12 +13422,9 @@ const MFA_STEP_API_IDS_V2 = {
13380
13422
  submitCode: MFA_V2_SUBMIT_CHALLENGE,
13381
13423
  resendCode: MFA_V2_RESEND_CHALLENGE,
13382
13424
  };
13383
- /**
13384
- * Resolves the telemetry API ID for a flow step. MFA challenge operations use
13385
- * distinct IDs when the sign-in caller identifies the second factor.
13386
- */
13387
13425
  function getPublicApiIdV2(scenario, step, authenticationFactor) {
13388
- if (scenario === CustomAuthFlowScenarioV2.SignIn &&
13426
+ if ((scenario === CustomAuthFlowScenarioV2.SignIn ||
13427
+ scenario === CustomAuthFlowScenarioV2.PasswordReset) &&
13389
13428
  authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
13390
13429
  return (MFA_STEP_API_IDS_V2[step] ?? FLOW_STEP_API_IDS_V2[scenario]?.[step]);
13391
13430
  }
@@ -13396,17 +13435,12 @@ function getPublicApiIdV2(scenario, step, authenticationFactor) {
13396
13435
  * Copyright (c) Microsoft Corporation. All rights reserved.
13397
13436
  * Licensed under the MIT License.
13398
13437
  */
13399
- /*
13400
- * Polls up to five times for password-update completion, waiting 1.5 seconds
13401
- * between attempts. The first request runs immediately.
13402
- */
13403
13438
  const POLL_MAX_ATTEMPTS = 5;
13404
13439
  // TODO: Replace this fallback with the server-provided polling interval once available.
13405
13440
  const POLL_INTERVAL_MS = 1500;
13406
13441
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
13407
13442
  /*
13408
- * Drives server-directed Native Auth V2 flows using opaque continuation state
13409
- * and HAL links. Each operation returns only its valid discriminated results.
13443
+ * Drives server-directed Native Auth V2 flows.
13410
13444
  */
13411
13445
  class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13412
13446
  constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority, apiClient) {
@@ -13414,8 +13448,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13414
13448
  this.apiClient = apiClient;
13415
13449
  }
13416
13450
  /*
13417
- * Starts sign-in by automatically using a sole supported method or returning
13418
- * multiple supported methods for user selection.
13451
+ * Starts native auth V2 sign-in.
13419
13452
  */
13420
13453
  async signIn(parameters) {
13421
13454
  const correlationId = parameters.correlationId;
@@ -13468,20 +13501,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13468
13501
  method: selectedMethod,
13469
13502
  };
13470
13503
  }
13471
- if (parameters.password) {
13472
- return this.submitSignInPassword({
13473
- correlationId,
13474
- continuationState: challengeResult.continuationState,
13475
- password: parameters.password,
13476
- });
13477
- }
13478
13504
  return challengeResult;
13479
13505
  }
13480
13506
  /*
13481
- * Starts sign-up and resolves the server-provided attribute-submission transition.
13507
+ * Starts native auth V2 sign-up.
13482
13508
  */
13483
13509
  async signUp(parameters) {
13484
13510
  const correlationId = parameters.correlationId;
13511
+ const pendingProfileAttributes = filterReservedSignUpAttributesV2(parameters.attributes, this.logger, correlationId);
13485
13512
  const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
13486
13513
  this.logger.verbose("19e1ak", correlationId);
13487
13514
  const scopes = this.getScopes(parameters.scopes);
@@ -13491,38 +13518,82 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13491
13518
  message: "The authorize-challenge entry response did not include a sign-up link.",
13492
13519
  }), {
13493
13520
  continuationToken: entryResult.continuationToken,
13521
+ username: parameters.username,
13494
13522
  }, context);
13495
- const attributes = Object.fromEntries(Object.entries(parameters.attributes ?? {}).filter(([name]) => name.toLowerCase() !== "email" &&
13496
- name.toLowerCase() !== "password"));
13497
- attributes.email = parameters.username;
13498
- if (parameters.password !== undefined) {
13499
- attributes.password = parameters.password;
13523
+ if (startResult.nextAction === VERIFY_RELATION) {
13524
+ if (startResult.type?.toLowerCase() !==
13525
+ AuthenticationMethodTypeV2.EMAIL) {
13526
+ const message = "New-account sign-up requires an email code challenge.";
13527
+ this.logger.error(message, correlationId);
13528
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13529
+ }
13530
+ return createFlowCodeRequiredResultV2({
13531
+ correlationId,
13532
+ continuationState: {
13533
+ continuationToken: startResult.continuationToken,
13534
+ scenario: CustomAuthFlowScenarioV2.SignUp,
13535
+ scopes,
13536
+ links: {
13537
+ verify: startResult.verifyHref,
13538
+ resend: startResult.resendHref,
13539
+ },
13540
+ signUp: {
13541
+ purpose: "newAccount",
13542
+ pendingProfileAttributes,
13543
+ submittedAttributeIds: [],
13544
+ },
13545
+ },
13546
+ channel: startResult.type,
13547
+ sentTo: startResult.hint,
13548
+ codeLength: startResult.codeLength,
13549
+ });
13500
13550
  }
13501
- const submitResult = await this.apiClient.submitSignUpAttributes(startResult.submitAttributesHref, {
13502
- continuationToken: startResult.continuationToken,
13503
- attributes,
13504
- }, context);
13505
13551
  const continuationState = {
13506
13552
  continuationToken: startResult.continuationToken,
13507
13553
  scenario: CustomAuthFlowScenarioV2.SignUp,
13508
13554
  scopes,
13509
13555
  links: {},
13510
13556
  signUp: {
13511
- passwordWasSupplied: attributes.password !== undefined,
13557
+ purpose: "existingAccount",
13512
13558
  },
13513
13559
  };
13514
- const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
13515
- if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 ||
13516
- result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
13517
- const message = `Initial sign-up attribute submission returned unsupported next action '${submitResult.nextAction}'.`;
13518
- this.logger.error(message, correlationId);
13519
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13560
+ this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "existing-account sign-up", correlationId);
13561
+ const supportedMethods = startResult.methods
13562
+ .map((method) => ({
13563
+ id: method.id,
13564
+ type: method.type ?? "",
13565
+ hint: method.hint,
13566
+ challengeHref: method.challengeHref,
13567
+ }))
13568
+ .filter((method) => {
13569
+ const methodType = method.type.toLowerCase();
13570
+ return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13571
+ methodType === AuthenticationMethodTypeV2.PASSWORD);
13572
+ });
13573
+ if (supportedMethods.length === 0) {
13574
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "The existing-account sign-up response must include an email or password method.", correlationId);
13520
13575
  }
13521
- return result;
13576
+ if (supportedMethods.length > 1) {
13577
+ return createFlowMethodSelectionRequiredResultV2({
13578
+ correlationId,
13579
+ continuationState,
13580
+ methods: supportedMethods,
13581
+ });
13582
+ }
13583
+ const selectedMethod = supportedMethods[0];
13584
+ const challengeResult = await this.requestChallenge({
13585
+ correlationId,
13586
+ continuationState: {
13587
+ ...continuationState,
13588
+ links: {
13589
+ challenge: selectedMethod.challengeHref,
13590
+ },
13591
+ },
13592
+ });
13593
+ return this.toExistingAccountChallengeResult(challengeResult, selectedMethod, correlationId);
13522
13594
  }
13523
13595
  /*
13524
- * Starts password reset, automatically challenging a sole method or
13525
- * returning multiple methods for selection.
13596
+ * Starts native auth V2 password reset.
13526
13597
  */
13527
13598
  async resetPassword(parameters) {
13528
13599
  const correlationId = parameters.correlationId;
@@ -13555,44 +13626,43 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13555
13626
  this.logger.error(message, correlationId);
13556
13627
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13557
13628
  }
13558
- if (methods.length === 1) {
13559
- const selectedMethod = methods[0];
13560
- const challengeResult = await this.requestChallenge({
13629
+ if (methods.length > 1) {
13630
+ this.logger.verbose("0k8yah", correlationId);
13631
+ return createFlowMethodSelectionRequiredResultV2({
13561
13632
  correlationId,
13562
- continuationState: {
13563
- ...continuationState,
13564
- links: {
13565
- challenge: selectedMethod.challengeHref,
13566
- },
13567
- },
13633
+ continuationState,
13634
+ methods,
13568
13635
  });
13569
- if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
13570
- (challengeResult.channel?.toLowerCase() ===
13571
- AuthenticationMethodTypeV2.EMAIL ||
13572
- challengeResult.channel?.toLowerCase() ===
13573
- AuthenticationMethodTypeV2.SMS)) {
13574
- return {
13575
- ...challengeResult,
13576
- method: selectedMethod,
13577
- };
13578
- }
13579
- const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
13580
- ? challengeResult.channel
13581
- : AuthenticationMethodTypeV2.PASSWORD;
13582
- const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
13583
- this.logger.error(message, correlationId);
13584
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13585
13636
  }
13586
- this.logger.verbose("0k8yah", correlationId);
13587
- return createFlowMethodSelectionRequiredResultV2({
13637
+ const selectedMethod = methods[0];
13638
+ const challengeResult = await this.requestChallenge({
13588
13639
  correlationId,
13589
- continuationState,
13590
- methods,
13640
+ continuationState: {
13641
+ ...continuationState,
13642
+ links: {
13643
+ challenge: selectedMethod.challengeHref,
13644
+ },
13645
+ },
13591
13646
  });
13647
+ if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
13648
+ (challengeResult.channel?.toLowerCase() ===
13649
+ AuthenticationMethodTypeV2.EMAIL ||
13650
+ challengeResult.channel?.toLowerCase() ===
13651
+ AuthenticationMethodTypeV2.SMS)) {
13652
+ return {
13653
+ ...challengeResult,
13654
+ method: selectedMethod,
13655
+ };
13656
+ }
13657
+ const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
13658
+ ? challengeResult.channel
13659
+ : AuthenticationMethodTypeV2.PASSWORD;
13660
+ const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
13661
+ this.logger.error(message, correlationId);
13662
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13592
13663
  }
13593
13664
  /*
13594
- * Requests a one-time code for the selected authentication method. Returns
13595
- * the continuation state and code metadata needed for verification.
13665
+ * Requests a challenge for the selected authentication method.
13596
13666
  */
13597
13667
  async requestChallenge(parameters) {
13598
13668
  const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
@@ -13622,7 +13692,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13622
13692
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13623
13693
  }
13624
13694
  /*
13625
- * Registers the selected offered method and returns activation metadata.
13695
+ * Registers the selected authentication method.
13626
13696
  */
13627
13697
  async registerAuthMethod(parameters) {
13628
13698
  const { continuationState, correlationId } = parameters;
@@ -13636,8 +13706,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13636
13706
  return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13637
13707
  }
13638
13708
  /*
13639
- * Activates the registered method and redeems the resulting continuation
13640
- * for tokens.
13709
+ * Activates the registered authentication method.
13641
13710
  */
13642
13711
  async verifyAuthMethodRegistration(parameters) {
13643
13712
  const { continuationState, correlationId } = parameters;
@@ -13647,11 +13716,22 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13647
13716
  continuationToken: continuationState.continuationToken,
13648
13717
  otp: parameters.code,
13649
13718
  }, context);
13719
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp ||
13720
+ continuationState.scenario ===
13721
+ CustomAuthFlowScenarioV2.PasswordReset) {
13722
+ return createFlowSignInContinuationRequiredResultV2({
13723
+ correlationId,
13724
+ continuationState: {
13725
+ ...continuationState,
13726
+ continuationToken: result.continuationToken,
13727
+ links: {},
13728
+ },
13729
+ });
13730
+ }
13650
13731
  return this.completeSignInAfterVerification(continuationState, result.continuationToken, correlationId);
13651
13732
  }
13652
13733
  /*
13653
- * Requests a replacement activation challenge through the server-provided
13654
- * resend link using the latest continuation token.
13734
+ * Requests a replacement authentication-method activation challenge.
13655
13735
  */
13656
13736
  async resendAuthMethodRegistrationChallenge(parameters) {
13657
13737
  const { continuationState, correlationId } = parameters;
@@ -13663,8 +13743,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13663
13743
  return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13664
13744
  }
13665
13745
  /*
13666
- * Verifies the submitted one-time code using the server-provided link. The
13667
- * response determines the next required action.
13746
+ * Verifies the submitted one-time code.
13668
13747
  */
13669
13748
  async submitCode(parameters) {
13670
13749
  const continuationState = parameters.continuationState;
@@ -13679,6 +13758,22 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13679
13758
  const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
13680
13759
  if (continuationState.scenario ===
13681
13760
  CustomAuthFlowScenarioV2.PasswordReset &&
13761
+ parameters.authenticationFactor ===
13762
+ AuthenticationFactorV2.MULTI_FACTOR &&
13763
+ verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13764
+ return createFlowSignInContinuationRequiredResultV2({
13765
+ correlationId,
13766
+ continuationState: {
13767
+ ...continuationState,
13768
+ continuationToken: verifyResult.continuationToken,
13769
+ links: {},
13770
+ },
13771
+ });
13772
+ }
13773
+ if (continuationState.scenario ===
13774
+ CustomAuthFlowScenarioV2.PasswordReset &&
13775
+ parameters.authenticationFactor !==
13776
+ AuthenticationFactorV2.MULTI_FACTOR &&
13682
13777
  verifyResult.nextAction === UPDATE_RELATION) {
13683
13778
  return createFlowNewPasswordRequiredResultV2({
13684
13779
  correlationId,
@@ -13693,6 +13788,10 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13693
13788
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
13694
13789
  return this.handleSignInVerification(continuationState, verifyResult, correlationId);
13695
13790
  }
13791
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
13792
+ continuationState.signUp?.purpose === "existingAccount") {
13793
+ return this.handleSignInVerification(continuationState, verifyResult, correlationId);
13794
+ }
13696
13795
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
13697
13796
  return this.handleSignUpVerification(continuationState, verifyResult, correlationId);
13698
13797
  }
@@ -13701,11 +13800,17 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13701
13800
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13702
13801
  }
13703
13802
  /*
13704
- * Requests a new one-time code using the server-provided resend link.
13705
- * Returns refreshed continuation state and code metadata.
13803
+ * Requests a replacement one-time code.
13706
13804
  */
13707
13805
  async resendCode(parameters) {
13708
13806
  const challengeResult = await this.sendMethodChallenge(parameters, "resendCode");
13807
+ const challengeType = challengeResult.type?.toLowerCase();
13808
+ if (challengeType !== AuthenticationMethodTypeV2.EMAIL &&
13809
+ challengeType !== AuthenticationMethodTypeV2.SMS) {
13810
+ const message = "A replacement code requires an email or SMS code challenge.";
13811
+ this.logger.error(message, parameters.correlationId);
13812
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13813
+ }
13709
13814
  return createFlowCodeRequiredResultV2({
13710
13815
  correlationId: parameters.correlationId,
13711
13816
  continuationState: this.createChallengeContinuationState(parameters.continuationState, challengeResult),
@@ -13715,24 +13820,31 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13715
13820
  });
13716
13821
  }
13717
13822
  async submitSignUpAttributes(parameters) {
13718
- const { continuationState, correlationId, attributes } = parameters;
13823
+ const { continuationState, correlationId, attributes: submittedAttributes, } = parameters;
13719
13824
  const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitAttributes", correlationId), correlationId);
13720
13825
  this.logger.verbose("0js2ub", correlationId);
13826
+ const submittedAttributeIds = Object.keys(submittedAttributes);
13721
13827
  const submitResult = await this.apiClient.submitSignUpAttributes(this.requireLink(correlationId, continuationState.links.submitAttributes), {
13722
13828
  continuationToken: continuationState.continuationToken,
13723
- attributes,
13829
+ attributes: submittedAttributes,
13724
13830
  }, context);
13725
- return this.toSignUpActionResult(submitResult, {
13831
+ return this.toSignUpSubmitAttributesResult(submitResult, {
13726
13832
  ...continuationState,
13727
13833
  signUp: {
13728
- passwordWasSupplied: continuationState.signUp?.passwordWasSupplied ===
13729
- true || attributes.password !== undefined,
13834
+ purpose: "newAccount",
13835
+ submittedAttributeIds: [
13836
+ ...new Set([
13837
+ ...(continuationState.signUp
13838
+ ?.submittedAttributeIds ?? []),
13839
+ ...submittedAttributeIds,
13840
+ ]),
13841
+ ],
13730
13842
  },
13731
13843
  }, correlationId);
13732
13844
  }
13733
13845
  /*
13734
- * Submits the new password and polls until the reset completes. The result
13735
- * contains the continuation state required for explicit sign-in.
13846
+ * Submits the new password and polls for the next action: method registration,
13847
+ * MFA, or a continuation for explicit sign-in.
13736
13848
  */
13737
13849
  async submitNewPassword(parameters) {
13738
13850
  const continuationState = parameters.continuationState;
@@ -13750,7 +13862,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13750
13862
  for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
13751
13863
  pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
13752
13864
  isPolling = pollResult.nextAction === POLL_RELATION;
13753
- if (!isPolling) {
13865
+ if (pollResult.nextAction !== POLL_RELATION) {
13754
13866
  break;
13755
13867
  }
13756
13868
  pollToken = pollResult.continuationToken;
@@ -13764,8 +13876,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13764
13876
  this.logger.error(message, correlationId);
13765
13877
  throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
13766
13878
  }
13767
- if (pollResult.nextAction === ENROLL_RELATION &&
13768
- pollResult.enrollmentMethods) {
13879
+ if (pollResult.nextAction === ENROLL_RELATION && pollResult.methods) {
13769
13880
  return this.createAuthMethodRegistrationRequiredResult({
13770
13881
  correlationId,
13771
13882
  continuationState: {
@@ -13773,7 +13884,30 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13773
13884
  continuationToken: pollResult.continuationToken,
13774
13885
  links: {},
13775
13886
  },
13776
- methods: pollResult.enrollmentMethods,
13887
+ methods: pollResult.methods,
13888
+ });
13889
+ }
13890
+ if (pollResult.nextAction === CHALLENGE_RELATION) {
13891
+ if (!pollResult.authenticationFactor) {
13892
+ const message = "Password-reset MFA challenge is missing its authentication factor.";
13893
+ this.logger.error(message, correlationId);
13894
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13895
+ }
13896
+ this.ensureAuthenticationFactor(pollResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after password reset", correlationId);
13897
+ return createFlowMFARequiredResultV2({
13898
+ correlationId,
13899
+ continuationState: {
13900
+ continuationToken: pollResult.continuationToken,
13901
+ scenario: continuationState.scenario,
13902
+ scopes: continuationState.scopes,
13903
+ links: {},
13904
+ },
13905
+ methods: pollResult.methods.map((method) => ({
13906
+ id: method.id,
13907
+ type: method.type ?? "",
13908
+ hint: method.hint,
13909
+ challengeHref: method.challengeHref,
13910
+ })),
13777
13911
  });
13778
13912
  }
13779
13913
  if (pollResult.nextAction === ResponseStateV2.CONTINUE) {
@@ -13793,15 +13927,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13793
13927
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13794
13928
  }
13795
13929
  /*
13796
- * Verifies a sign-in password and returns the next sign-in action.
13930
+ * Verifies the sign-in password.
13797
13931
  */
13798
13932
  async submitSignInPassword(parameters) {
13799
13933
  const verifyResult = await this.verifySignInPassword(parameters);
13800
13934
  return this.handleSignInVerification(parameters.continuationState, verifyResult, parameters.correlationId);
13801
13935
  }
13802
13936
  /*
13803
- * Redeems the completed flow continuation for tokens. Returns the
13804
- * authentication result after validating and caching the response.
13937
+ * Signs the user in from a completed flow.
13805
13938
  */
13806
13939
  async signInWithContinuation(parameters) {
13807
13940
  const continuationState = parameters.continuationState;
@@ -13832,13 +13965,12 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13832
13965
  });
13833
13966
  }
13834
13967
  if (verifyResult.nextAction === CHALLENGE_RELATION) {
13835
- this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
13968
+ this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after authentication verification", correlationId);
13836
13969
  return createFlowMFARequiredResultV2({
13837
13970
  correlationId,
13838
13971
  continuationState: {
13972
+ ...continuationState,
13839
13973
  continuationToken: verifyResult.continuationToken,
13840
- scenario: continuationState.scenario,
13841
- scopes: continuationState.scopes,
13842
13974
  links: {},
13843
13975
  },
13844
13976
  methods: verifyResult.methods.map((method) => ({
@@ -13852,37 +13984,41 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13852
13984
  if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13853
13985
  return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
13854
13986
  }
13855
- const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
13987
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for authentication.`;
13856
13988
  this.logger.error(message, correlationId);
13857
13989
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13858
13990
  }
13859
- handleSignUpVerification(continuationState, verifyResult, correlationId) {
13991
+ async handleSignUpVerification(continuationState, verifyResult, correlationId) {
13860
13992
  if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
13861
- const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
13862
- attribute.required === true);
13993
+ const requestedAttributes = verifyResult.attributes;
13994
+ const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
13863
13995
  const nextContinuationState = {
13996
+ ...continuationState,
13864
13997
  continuationToken: verifyResult.continuationToken,
13865
- scenario: continuationState.scenario,
13866
- scopes: continuationState.scopes,
13867
13998
  links: {
13868
13999
  submitAttributes: verifyResult.submitAttributesHref,
13869
14000
  },
13870
- signUp: continuationState.signUp,
13871
14001
  };
13872
- const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
13873
- if (requiredPasswordAttribute &&
13874
- continuationState.signUp?.passwordWasSupplied !== true) {
14002
+ const pendingProfileAttributes = continuationState.signUp?.pendingProfileAttributes;
14003
+ if (pendingProfileAttributes &&
14004
+ Object.keys(pendingProfileAttributes).length > 0) {
14005
+ return this.submitSignUpAttributes({
14006
+ correlationId,
14007
+ continuationState: nextContinuationState,
14008
+ attributes: pendingProfileAttributes,
14009
+ });
14010
+ }
14011
+ if (requestedPasswordAttribute) {
13875
14012
  return createFlowSignUpPasswordRequiredResultV2({
13876
14013
  correlationId,
13877
14014
  continuationState: nextContinuationState,
13878
- attributes,
13879
- requiredPasswordAttribute,
14015
+ requestedPasswordAttribute,
13880
14016
  });
13881
14017
  }
13882
14018
  return createFlowAttributesRequiredResultV2({
13883
14019
  correlationId,
13884
14020
  continuationState: nextContinuationState,
13885
- attributes,
14021
+ attributes: requestedAttributes,
13886
14022
  });
13887
14023
  }
13888
14024
  if (verifyResult.nextAction === ENROLL_RELATION) {
@@ -13900,9 +14036,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13900
14036
  return createFlowSignInContinuationRequiredResultV2({
13901
14037
  correlationId,
13902
14038
  continuationState: {
14039
+ ...continuationState,
13903
14040
  continuationToken: verifyResult.continuationToken,
13904
- scenario: continuationState.scenario,
13905
- scopes: continuationState.scopes,
13906
14041
  links: {},
13907
14042
  },
13908
14043
  });
@@ -13998,26 +14133,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13998
14133
  codeLength: result.codeLength,
13999
14134
  });
14000
14135
  }
14001
- toSignUpActionResult(result, continuationState, correlationId) {
14136
+ toSignUpSubmitAttributesResult(result, continuationState, correlationId) {
14002
14137
  const nextAction = result.nextAction;
14003
- if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
14004
- return createFlowCodeRequiredResultV2({
14005
- correlationId,
14006
- continuationState: {
14007
- continuationToken: result.continuationToken,
14008
- scenario: continuationState.scenario,
14009
- scopes: continuationState.scopes,
14010
- links: {
14011
- verify: result.verifyHref,
14012
- resend: result.resendHref,
14013
- },
14014
- signUp: continuationState.signUp,
14015
- },
14016
- channel: result.type,
14017
- sentTo: result.hint,
14018
- codeLength: result.codeLength,
14019
- });
14020
- }
14021
14138
  if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
14022
14139
  return this.createAuthMethodRegistrationRequiredResult({
14023
14140
  correlationId,
@@ -14031,40 +14148,35 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14031
14148
  }
14032
14149
  if (result.nextAction ===
14033
14150
  SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
14034
- const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
14035
- attribute.required === true);
14151
+ const requestedAttributes = result.attributes;
14152
+ this.ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId);
14036
14153
  const nextContinuationState = {
14154
+ ...continuationState,
14037
14155
  continuationToken: result.continuationToken,
14038
- scenario: continuationState.scenario,
14039
- scopes: continuationState.scopes,
14040
14156
  links: {
14041
14157
  submitAttributes: result.submitAttributesHref,
14042
14158
  },
14043
- signUp: continuationState.signUp,
14044
14159
  };
14045
- const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
14046
- if (requiredPasswordAttribute &&
14047
- continuationState.signUp?.passwordWasSupplied !== true) {
14160
+ const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
14161
+ if (requestedPasswordAttribute) {
14048
14162
  return createFlowSignUpPasswordRequiredResultV2({
14049
14163
  correlationId,
14050
14164
  continuationState: nextContinuationState,
14051
- attributes,
14052
- requiredPasswordAttribute,
14165
+ requestedPasswordAttribute,
14053
14166
  });
14054
14167
  }
14055
14168
  return createFlowAttributesRequiredResultV2({
14056
14169
  correlationId,
14057
14170
  continuationState: nextContinuationState,
14058
- attributes,
14171
+ attributes: requestedAttributes,
14059
14172
  });
14060
14173
  }
14061
14174
  if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
14062
14175
  return createFlowSignInContinuationRequiredResultV2({
14063
14176
  correlationId,
14064
14177
  continuationState: {
14178
+ ...continuationState,
14065
14179
  continuationToken: result.continuationToken,
14066
- scenario: continuationState.scenario,
14067
- scopes: continuationState.scopes,
14068
14180
  links: {},
14069
14181
  },
14070
14182
  });
@@ -14073,6 +14185,20 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14073
14185
  this.logger.error(message, correlationId);
14074
14186
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14075
14187
  }
14188
+ ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId) {
14189
+ const submittedAttributeIds = continuationState.signUp?.submittedAttributeIds ?? [];
14190
+ const hasSubmittedPassword = submittedAttributeIds.some((attributeId) => attributeId.toLowerCase() === "password");
14191
+ const invalidAttribute = requestedAttributes.find((requestedAttribute) => requestedAttribute.attributeId.toLowerCase() === "password"
14192
+ ? hasSubmittedPassword
14193
+ : submittedAttributeIds.includes(requestedAttribute.attributeId));
14194
+ if (invalidAttribute) {
14195
+ const message = invalidAttribute.attributeId.toLowerCase() === "password"
14196
+ ? "The sign-up API cannot request password collection after attribute submission."
14197
+ : "The sign-up API requested an attribute that was already successfully submitted.";
14198
+ this.logger.error(message, correlationId);
14199
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14200
+ }
14201
+ }
14076
14202
  ensureAuthenticationFactor(authenticationFactor, expectedFactor, transition, correlationId) {
14077
14203
  if (authenticationFactor === expectedFactor) {
14078
14204
  return;
@@ -14081,10 +14207,33 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14081
14207
  this.logger.error(message, correlationId);
14082
14208
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14083
14209
  }
14210
+ toExistingAccountChallengeResult(challengeResult, method, correlationId) {
14211
+ if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
14212
+ challengeResult.channel?.toLowerCase() ===
14213
+ AuthenticationMethodTypeV2.EMAIL) {
14214
+ return createFlowExistingAccountCodeRequiredResultV2({
14215
+ correlationId,
14216
+ continuationState: challengeResult.continuationState,
14217
+ method,
14218
+ channel: challengeResult.channel,
14219
+ sentTo: challengeResult.sentTo,
14220
+ codeLength: challengeResult.codeLength,
14221
+ });
14222
+ }
14223
+ if (challengeResult.type === FLOW_PASSWORD_REQUIRED_V2) {
14224
+ return createFlowExistingAccountPasswordRequiredResultV2({
14225
+ correlationId,
14226
+ continuationState: challengeResult.continuationState,
14227
+ });
14228
+ }
14229
+ const message = "Existing-account sign-up requires an email code challenge or a password challenge.";
14230
+ this.logger.error(message, correlationId);
14231
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14232
+ }
14084
14233
  async verifySignInPassword(parameters) {
14085
14234
  const { continuationState, correlationId } = parameters;
14086
14235
  const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitPassword", correlationId), correlationId);
14087
- this.logger.verbose("1bi1xn", correlationId);
14236
+ this.logger.verbose("13uf3o", correlationId);
14088
14237
  return this.apiClient.verifyChallenge(this.requireLink(correlationId, continuationState.links.verify), {
14089
14238
  continuationToken: continuationState.continuationToken,
14090
14239
  password: parameters.password,
@@ -14094,9 +14243,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14094
14243
  return this.signInWithContinuation({
14095
14244
  correlationId,
14096
14245
  continuationState: {
14246
+ ...continuationState,
14097
14247
  continuationToken,
14098
- scenario: continuationState.scenario,
14099
- scopes: continuationState.scopes,
14100
14248
  links: {},
14101
14249
  },
14102
14250
  });
@@ -14125,18 +14273,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14125
14273
  }
14126
14274
  createChallengeContinuationState(continuationState, challengeResult) {
14127
14275
  return {
14276
+ ...continuationState,
14128
14277
  continuationToken: challengeResult.continuationToken,
14129
- scenario: continuationState.scenario,
14130
- scopes: continuationState.scopes,
14131
14278
  links: {
14132
14279
  challenge: continuationState.links.challenge,
14133
14280
  verify: challengeResult.verifyHref,
14134
14281
  resend: challengeResult.resendHref ??
14135
14282
  continuationState.links.resend,
14136
14283
  },
14137
- ...(continuationState.signUp && {
14138
- signUp: continuationState.signUp,
14139
- }),
14140
14284
  };
14141
14285
  }
14142
14286
  resolveStepApiId(scenario, step, correlationId, authenticationFactor) {
@@ -14166,8 +14310,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
14166
14310
  */
14167
14311
  /**
14168
14312
  * Terminal state indicating the operation failed.
14169
- *
14170
- * The error is carried by the result's `error` payload, not by this state.
14313
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14171
14314
  */
14172
14315
  class FailedStateV2 extends AuthFlowStateBase {
14173
14316
  constructor() {
@@ -14180,8 +14323,14 @@ class FailedStateV2 extends AuthFlowStateBase {
14180
14323
  * Copyright (c) Microsoft Corporation. All rights reserved.
14181
14324
  * Licensed under the MIT License.
14182
14325
  */
14326
+ const ATTRIBUTE_VALIDATION_ERROR = "attributeValidationError";
14183
14327
  const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
14184
14328
  const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
14329
+ const PASSWORD_BANNED = "passwordBanned";
14330
+ const PASSWORD_IS_INVALID = "passwordIsInvalid";
14331
+ const PASSWORD_RECENTLY_USED = "passwordRecentlyUsed";
14332
+ const PASSWORD_TOO_LONG = "passwordTooLong";
14333
+ const PASSWORD_TOO_SHORT = "passwordTooShort";
14185
14334
  const PASSWORD_TOO_WEAK = "passwordTooWeak";
14186
14335
  const USER_NOT_FOUND = "userNotFound";
14187
14336
 
@@ -14190,12 +14339,13 @@ const USER_NOT_FOUND = "userNotFound";
14190
14339
  * Licensed under the MIT License.
14191
14340
  */
14192
14341
  /**
14193
- * Error returned by a native authentication V2 operation. Use its classifiers
14194
- * to handle known failures while retaining raw diagnostics through `errorData`.
14342
+ * Error returned by a native authentication V2 operation.
14343
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14195
14344
  */
14196
14345
  class AuthFlowErrorV2 {
14197
- constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
14346
+ constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown, errorContext = "default") {
14198
14347
  this.errorData = errorData;
14348
+ this.errorContext = errorContext;
14199
14349
  this.scenario = scenario;
14200
14350
  }
14201
14351
  get correlationId() {
@@ -14212,123 +14362,111 @@ class AuthFlowErrorV2 {
14212
14362
  ? this.errorData.innerErrorCode
14213
14363
  : undefined;
14214
14364
  }
14215
- /**
14216
- * Gets the attribute ids that the service reports as required.
14217
- */
14218
14365
  get requiredAttributes() {
14219
14366
  return this.getAttributeIdsByCode("attributeRequired");
14220
14367
  }
14221
- /**
14222
- * Gets the attribute ids whose submitted values failed validation.
14223
- */
14224
14368
  get invalidAttributes() {
14225
14369
  return this.getAttributeIdsByCode("attributeValidationFailed");
14226
14370
  }
14227
14371
  /**
14228
- * Checks if the error requires the flow to continue in the browser. The
14229
- * server surfaces this as the `web_redirect_required` OAuth suberror, so a
14230
- * browser hand-off arrives as a `FailedStateV2` on which this detector
14231
- * returns true.
14372
+ * Checks whether the flow must continue in the browser.
14232
14373
  * @returns True if the browser is required, false otherwise.
14233
14374
  */
14234
14375
  isBrowserRequired() {
14235
- return this.errorData.subError === WEB_REDIRECT_REQUIRED;
14376
+ return (this.errorData.error === "invalid_grant" &&
14377
+ this.errorData.subError === WEB_REDIRECT_REQUIRED);
14236
14378
  }
14237
14379
  /**
14238
- * Checks if the error is due to a caller-supplied argument failing
14239
- * client-side validation before the request was issued (for example an empty
14240
- * username, code, or password, or an unknown method id). Use it to prompt the
14241
- * user to correct the input rather than treating it as a server failure.
14380
+ * Checks whether a caller-supplied argument failed client-side validation.
14242
14381
  * @returns True if the input was invalid, false otherwise.
14243
14382
  */
14244
14383
  isInvalidInput() {
14245
14384
  return this.errorData instanceof InvalidArgumentError;
14246
14385
  }
14247
14386
  /**
14248
- * Checks whether the service rejected the username parameter. Use it to ask
14249
- * the user to correct the supplied username.
14250
- * @returns True when the username is invalid, otherwise false.
14387
+ * Checks whether the supplied username failed local validation.
14388
+ * @returns True when local username validation failed.
14251
14389
  */
14252
14390
  isInvalidUsername() {
14253
- return this.isUserInvalidError();
14391
+ return (this.errorData instanceof InvalidArgumentError &&
14392
+ this.errorData.argName === "inputs.username");
14254
14393
  }
14255
14394
  /**
14256
- * Checks whether the supplied username does not identify an account. Use it
14257
- * to distinguish a missing account from other request failures.
14395
+ * Checks whether the supplied username does not identify an account.
14258
14396
  * @returns True when the service reports that the user was not found.
14259
14397
  */
14260
14398
  isUserNotFound() {
14261
14399
  return this.isUserNotFoundError();
14262
14400
  }
14263
14401
  /**
14264
- * Checks whether the service rejected the supplied sign-in credentials. This
14265
- * classifier does not identify new-password policy failures.
14266
- * @returns True when the username or password is incorrect.
14267
- */
14268
- isInvalidCredentials() {
14269
- return this.isPasswordIncorrectError();
14270
- }
14271
- /**
14272
- * Checks whether the service rejected a one-time code. Use it to prompt the
14273
- * user to re-enter the code or request a new one.
14402
+ * Checks whether the service rejected a one-time code.
14274
14403
  * @returns True when the one-time code is invalid, otherwise false.
14275
14404
  */
14276
14405
  isInvalidCode() {
14277
- return this.isInvalidCodeError();
14406
+ return this.errorContext === "default" && this.isInvalidCodeError();
14278
14407
  }
14279
14408
  /**
14280
- * Checks whether a new password violates password policy. It recognizes
14281
- * both weak-password responses and password-targeted validation details.
14282
- * @returns True when the new password is invalid, otherwise false.
14409
+ * Checks whether the service rejected an MFA or registration challenge.
14410
+ * @returns True when the verification challenge is invalid.
14283
14411
  */
14284
- isInvalidPassword() {
14285
- return (this.isInvalidPasswordError() ||
14286
- this.isPasswordPolicyViolationError());
14412
+ isInvalidChallenge() {
14413
+ return ((this.errorContext === "mfaVerification" ||
14414
+ this.errorContext === "authMethodRegistration") &&
14415
+ this.isInvalidCodeError());
14287
14416
  }
14288
14417
  /**
14289
- * Checks whether an account already exists for the supplied identifier.
14290
- * This can occur at different stages while completing sign-up.
14291
- * @returns True if the account already exists, otherwise false.
14418
+ * Checks whether the service rejected non-password attributes.
14419
+ * Password-targeted validation is reported only by isInvalidPassword().
14420
+ * @returns True when at least one non-password attribute is invalid.
14292
14421
  */
14293
- isUserAlreadyExists() {
14294
- return this.getAttributeValidationDetails().some((detail) => detail.code === "userAlreadyExists");
14422
+ isInvalidAttributes() {
14423
+ if (!this.isAttributeValidationError() ||
14424
+ this.isPasswordAttributeValidationError()) {
14425
+ return false;
14426
+ }
14427
+ const attributeIds = this.getAttributeValidationDetails()
14428
+ .flatMap((detail) => Array.isArray(detail.attributeIds) ? detail.attributeIds : [])
14429
+ .filter((attributeId) => typeof attributeId === "string");
14430
+ return attributeIds.some((attributeId) => attributeId.length > 0);
14295
14431
  }
14296
14432
  /**
14297
- * Checks whether the service requires attributes omitted from the request.
14298
- * Use it to collect the required attributes before resubmitting.
14299
- * @returns True when required attributes are missing, otherwise false.
14433
+ * Checks whether the service rejected a supplied password.
14434
+ * @returns True when the supplied password is invalid, otherwise false.
14300
14435
  */
14301
- isMissingRequiredAttributes() {
14302
- return this.requiredAttributes.length > 0;
14436
+ isInvalidPassword() {
14437
+ return (this.isPasswordIncorrectError() ||
14438
+ this.isInvalidPasswordError() ||
14439
+ this.isPasswordAttributeValidationError());
14303
14440
  }
14304
- isUserNotFoundError() {
14441
+ isAttributeValidationError() {
14305
14442
  return (this.errorData.error === "invalidRequest" &&
14306
- (this.innerErrorCode === USER_NOT_FOUND ||
14307
- this.errorData.errorDescription?.includes("AADSTS50034") ===
14308
- true));
14443
+ this.innerErrorCode === ATTRIBUTE_VALIDATION_ERROR);
14309
14444
  }
14310
- isUserInvalidError() {
14445
+ isUserNotFoundError() {
14311
14446
  return (this.errorData.error === "invalidRequest" &&
14312
- this.errorData.errorDescription?.includes("AADSTS90100") === true &&
14313
- this.errorData.errorDescription
14314
- .toLowerCase()
14315
- .includes("username parameter"));
14447
+ this.innerErrorCode === USER_NOT_FOUND);
14316
14448
  }
14317
14449
  isInvalidCodeError() {
14318
14450
  return (this.errorData.error === "invalidGrant" &&
14319
14451
  this.innerErrorCode === INVALID_ONE_TIME_CODE);
14320
14452
  }
14321
14453
  isInvalidPasswordError() {
14454
+ const innerErrorCode = this.innerErrorCode;
14322
14455
  return (this.errorData.error === "invalidRequest" &&
14323
- this.innerErrorCode === PASSWORD_TOO_WEAK);
14324
- }
14325
- isPasswordPolicyViolationError() {
14456
+ (innerErrorCode === PASSWORD_TOO_WEAK ||
14457
+ innerErrorCode === PASSWORD_TOO_SHORT ||
14458
+ innerErrorCode === PASSWORD_TOO_LONG ||
14459
+ innerErrorCode === PASSWORD_IS_INVALID ||
14460
+ innerErrorCode === PASSWORD_RECENTLY_USED ||
14461
+ innerErrorCode === PASSWORD_BANNED));
14462
+ }
14463
+ isPasswordAttributeValidationError() {
14464
+ if (!this.isAttributeValidationError()) {
14465
+ return false;
14466
+ }
14326
14467
  return this.getAttributeValidationDetails().some((detail) => {
14327
14468
  const attributeIds = detail.attributeIds;
14328
- return (detail.code === "passwordPolicyViolation" &&
14329
- Array.isArray(attributeIds) &&
14330
- attributeIds.some((attributeId) => typeof attributeId === "string" &&
14331
- attributeId.toLowerCase() === "password"));
14469
+ return (Array.isArray(attributeIds) && attributeIds.includes("password"));
14332
14470
  });
14333
14471
  }
14334
14472
  isPasswordIncorrectError() {
@@ -14354,8 +14492,8 @@ class AuthFlowErrorV2 {
14354
14492
  * Licensed under the MIT License.
14355
14493
  */
14356
14494
  /**
14357
- * Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
14358
- * to narrow the state before accessing its members.
14495
+ * Result of a native auth V2 operation.
14496
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14359
14497
  */
14360
14498
  class CustomAuthResultV2 {
14361
14499
  constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
@@ -14364,8 +14502,7 @@ class CustomAuthResultV2 {
14364
14502
  this.scenario = scenario;
14365
14503
  }
14366
14504
  /**
14367
- * Narrows the result to a specific state by its `stateType` discriminator.
14368
- * A successful match makes the state's properties available without a cast.
14505
+ * Checks whether the result matches a state type and narrows its state.
14369
14506
  * @param stateType - The state type to test for.
14370
14507
  * @returns True (and narrows `state`) when the current state matches `stateType`.
14371
14508
  */
@@ -14373,25 +14510,32 @@ class CustomAuthResultV2 {
14373
14510
  return this.state.stateType === stateType;
14374
14511
  }
14375
14512
  /**
14376
- * Checks whether the result is in the terminal failed state. A failed result
14377
- * contains the unified V2 flow error.
14513
+ * Checks whether the operation failed.
14378
14514
  * @returns True (and narrows `state`) when the operation failed.
14379
14515
  */
14380
14516
  isFailed() {
14381
14517
  return this.state.stateType === "failed";
14382
14518
  }
14383
14519
  /**
14384
- * Creates a failed result from the supplied error. The result uses the
14385
- * shared {@link FailedStateV2} terminal state and unified V2 flow error.
14520
+ * Checks whether the current state requires a password.
14521
+ * @returns True (and narrows `state`) when a password is required.
14522
+ */
14523
+ isPasswordRequired() {
14524
+ return this.state.stateType === "passwordRequired";
14525
+ }
14526
+ /**
14527
+ * Creates a failed result from the supplied error.
14528
+ * Optional error context identifies MFA verification or authentication-method registration.
14386
14529
  * @param error - The error that occurred.
14387
14530
  * @param options - The flow-error context.
14388
14531
  * @returns A failed result carrying the unified V2 flow error.
14389
14532
  */
14390
14533
  static createWithError(error, options) {
14391
- const { scenario = CustomAuthFlowScenarioV2.Unknown, correlationId } = options;
14392
- const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
14393
- const flowError = new AuthFlowErrorV2(errorData, scenario);
14394
- const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
14534
+ const { correlationId } = options;
14535
+ const flowError = error instanceof AuthFlowErrorV2
14536
+ ? error
14537
+ : new AuthFlowErrorV2(CustomAuthResultV2.createErrorData(error, correlationId), options.scenario ?? CustomAuthFlowScenarioV2.Unknown, options.errorContext);
14538
+ const result = new CustomAuthResultV2(new FailedStateV2(), undefined, flowError.scenario);
14395
14539
  result.error = flowError;
14396
14540
  return result;
14397
14541
  }
@@ -14424,9 +14568,7 @@ class CustomAuthResultV2 {
14424
14568
  */
14425
14569
  /**
14426
14570
  * Terminal state indicating the operation completed successfully.
14427
- *
14428
- * Completion data (for example the signed-in account) is carried by the
14429
- * result's `data` payload, not by this state.
14571
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14430
14572
  */
14431
14573
  class CompletedStateV2 extends AuthFlowStateBase {
14432
14574
  constructor() {
@@ -14440,21 +14582,90 @@ class CompletedStateV2 extends AuthFlowStateBase {
14440
14582
  * Licensed under the MIT License.
14441
14583
  */
14442
14584
  /**
14443
- * State returned when a newly registered authentication method must be
14444
- * activated with the challenge sent by the service.
14585
+ * State returned when a completed V2 flow can sign the user in.
14586
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14445
14587
  */
14446
- class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14447
- constructor(stateParameters) {
14448
- super(stateParameters);
14449
- this.stateType = "authMethodVerificationRequired";
14450
- this.type = stateParameters.type;
14451
- this.sentTo = stateParameters.sentTo;
14452
- this.codeLength = stateParameters.codeLength;
14588
+ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
14589
+ constructor() {
14590
+ super(...arguments);
14591
+ this.stateType = "signInContinuation";
14453
14592
  }
14454
14593
  /**
14455
- * Submits the activation challenge for the registered method.
14456
- * @param challenge - The activation challenge to submit.
14457
- * @returns The completed authentication result or a failed state.
14594
+ * Signs the user in after completing the V2 flow.
14595
+ * @returns The result of completing the continuation sign-in.
14596
+ */
14597
+ async signIn() {
14598
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14599
+ try {
14600
+ logger.verbose("09mk3f", correlationId);
14601
+ const result = await flowClient.signInWithContinuation({
14602
+ correlationId,
14603
+ continuationState,
14604
+ });
14605
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14606
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14607
+ }
14608
+ catch (error) {
14609
+ logger.errorPii(`0zoo5u ${error}`, correlationId);
14610
+ return CustomAuthResultV2.createWithError(error, {
14611
+ scenario: continuationState.scenario,
14612
+ correlationId,
14613
+ });
14614
+ }
14615
+ }
14616
+ }
14617
+
14618
+ /*
14619
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14620
+ * Licensed under the MIT License.
14621
+ */
14622
+ class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
14623
+ constructor(stateParameters) {
14624
+ super(stateParameters);
14625
+ this.method = stateParameters.method;
14626
+ this.sentTo = stateParameters.sentTo;
14627
+ this.channel = stateParameters.channel;
14628
+ this.codeLength = stateParameters.codeLength;
14629
+ }
14630
+ async submitCodeCore(code, authenticationFactor) {
14631
+ ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
14632
+ return this.stateParameters.flowClient.submitCode({
14633
+ correlationId: this.stateParameters.correlationId,
14634
+ continuationState: this.stateParameters.continuationState,
14635
+ authenticationFactor,
14636
+ code,
14637
+ });
14638
+ }
14639
+ async resendCodeCore(authenticationFactor) {
14640
+ return this.stateParameters.flowClient.resendCode({
14641
+ correlationId: this.stateParameters.correlationId,
14642
+ continuationState: this.stateParameters.continuationState,
14643
+ authenticationFactor,
14644
+ });
14645
+ }
14646
+ }
14647
+
14648
+ /*
14649
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14650
+ * Licensed under the MIT License.
14651
+ */
14652
+ /**
14653
+ * State returned when a newly registered authentication method must be
14654
+ * activated with the challenge sent by the service.
14655
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14656
+ */
14657
+ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14658
+ constructor(stateParameters) {
14659
+ super(stateParameters);
14660
+ this.stateType = "authMethodVerificationRequired";
14661
+ this.type = stateParameters.type;
14662
+ this.sentTo = stateParameters.sentTo;
14663
+ this.codeLength = stateParameters.codeLength;
14664
+ }
14665
+ /**
14666
+ * Submits the activation challenge for the registered method.
14667
+ * @param challenge - The activation challenge to submit.
14668
+ * @returns A sign-in continuation, completed authentication result, or failed state.
14458
14669
  */
14459
14670
  async submitChallenge(challenge) {
14460
14671
  const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
@@ -14466,6 +14677,16 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
14466
14677
  continuationState,
14467
14678
  code: challenge,
14468
14679
  });
14680
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14681
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
14682
+ correlationId: result.correlationId,
14683
+ logger,
14684
+ config: this.stateParameters.config,
14685
+ flowClient,
14686
+ continuationState: result.continuationState,
14687
+ cacheClient: this.stateParameters.cacheClient,
14688
+ }), undefined, result.continuationState.scenario);
14689
+ }
14469
14690
  const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14470
14691
  return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14471
14692
  }
@@ -14474,12 +14695,12 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
14474
14695
  return CustomAuthResultV2.createWithError(error, {
14475
14696
  scenario: continuationState.scenario,
14476
14697
  correlationId,
14698
+ errorContext: "authMethodRegistration",
14477
14699
  });
14478
14700
  }
14479
14701
  }
14480
14702
  /**
14481
- * Requests a replacement activation challenge using the retained server
14482
- * resend link.
14703
+ * Requests a replacement activation challenge for the registered method.
14483
14704
  * @returns Refreshed activation metadata or a failed state.
14484
14705
  */
14485
14706
  async resendChallenge() {
@@ -14517,8 +14738,8 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
14517
14738
  * Licensed under the MIT License.
14518
14739
  */
14519
14740
  /**
14520
- * State returned when an authentication method must be registered. Applications
14521
- * select one of the sanitized offered methods and provide its contact value.
14741
+ * State returned when an authentication method must be registered.
14742
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14522
14743
  */
14523
14744
  class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14524
14745
  constructor(stateParameters) {
@@ -14575,143 +14796,8 @@ class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateB
14575
14796
  * Licensed under the MIT License.
14576
14797
  */
14577
14798
  /**
14578
- * Shared state returned when a completed V2 flow can sign the user in by
14579
- * redeeming its continuation. Password reset and sign-up can both surface this
14580
- * state without duplicating the token-acquisition behavior.
14581
- */
14582
- class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
14583
- constructor() {
14584
- super(...arguments);
14585
- this.stateType = "signInContinuation";
14586
- }
14587
- /**
14588
- * Signs the user in using the continuation established by the completed V2
14589
- * flow. The result either reaches the completed state with the signed-in
14590
- * account data or reports why the follow-up sign-in could not complete.
14591
- * @returns The result of completing the continuation sign-in.
14592
- */
14593
- async signIn() {
14594
- const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14595
- try {
14596
- logger.verbose("09mk3f", correlationId);
14597
- const result = await flowClient.signInWithContinuation({
14598
- correlationId,
14599
- continuationState,
14600
- });
14601
- const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14602
- return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14603
- }
14604
- catch (error) {
14605
- logger.errorPii(`0zoo5u ${error}`, correlationId);
14606
- return CustomAuthResultV2.createWithError(error, {
14607
- scenario: continuationState.scenario,
14608
- correlationId,
14609
- });
14610
- }
14611
- }
14612
- }
14613
-
14614
- /*
14615
- * Copyright (c) Microsoft Corporation. All rights reserved.
14616
- * Licensed under the MIT License.
14617
- */
14618
- /**
14619
- * State returned when the user must supply a new password to complete the flow.
14620
- * A successful submission can require registration or return a continuation
14621
- * for sign-in.
14622
- */
14623
- class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14624
- constructor() {
14625
- super(...arguments);
14626
- this.stateType = "newPasswordRequired";
14627
- }
14628
- /**
14629
- * Submits the new password to complete the reset. Enrollment may be
14630
- * required before sign-in; a rejected password returns an error.
14631
- * @param password - The new password to set.
14632
- * @returns The result of submitting the new password.
14633
- */
14634
- async submitNewPassword(password) {
14635
- const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14636
- try {
14637
- this.ensurePasswordIsNotEmpty(password);
14638
- logger.verbose("0ie1qa", correlationId);
14639
- const result = await flowClient.submitNewPassword({
14640
- correlationId,
14641
- continuationState,
14642
- newPassword: password,
14643
- });
14644
- const resultType = result.type;
14645
- if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
14646
- return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
14647
- correlationId: result.correlationId,
14648
- logger,
14649
- config: this.stateParameters.config,
14650
- flowClient,
14651
- continuationState: result.continuationState,
14652
- cacheClient: this.stateParameters.cacheClient,
14653
- methods: result.methods,
14654
- }), undefined, result.continuationState.scenario);
14655
- }
14656
- if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14657
- return new CustomAuthResultV2(new SignInContinuationStateV2({
14658
- correlationId: result.correlationId,
14659
- logger,
14660
- config: this.stateParameters.config,
14661
- flowClient,
14662
- continuationState: result.continuationState,
14663
- cacheClient: this.stateParameters.cacheClient,
14664
- }), undefined, result.continuationState.scenario);
14665
- }
14666
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
14667
- }
14668
- catch (error) {
14669
- logger.errorPii(`03m081 ${error}`, correlationId);
14670
- return CustomAuthResultV2.createWithError(error, {
14671
- scenario: continuationState.scenario,
14672
- correlationId,
14673
- });
14674
- }
14675
- }
14676
- }
14677
-
14678
- /*
14679
- * Copyright (c) Microsoft Corporation. All rights reserved.
14680
- * Licensed under the MIT License.
14681
- */
14682
- class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
14683
- constructor(stateParameters) {
14684
- super(stateParameters);
14685
- this.method = stateParameters.method;
14686
- this.sentTo = stateParameters.sentTo;
14687
- this.channel = stateParameters.channel;
14688
- this.codeLength = stateParameters.codeLength;
14689
- }
14690
- async submitCodeCore(code, authenticationFactor) {
14691
- ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
14692
- return this.stateParameters.flowClient.submitCode({
14693
- correlationId: this.stateParameters.correlationId,
14694
- continuationState: this.stateParameters.continuationState,
14695
- authenticationFactor,
14696
- code,
14697
- });
14698
- }
14699
- async resendCodeCore(authenticationFactor) {
14700
- return this.stateParameters.flowClient.resendCode({
14701
- correlationId: this.stateParameters.correlationId,
14702
- continuationState: this.stateParameters.continuationState,
14703
- authenticationFactor,
14704
- });
14705
- }
14706
- }
14707
-
14708
- /*
14709
- * Copyright (c) Microsoft Corporation. All rights reserved.
14710
- * Licensed under the MIT License.
14711
- */
14712
- /**
14713
- * State returned when first-factor email authentication requires a one-time
14714
- * code. It allows the app to submit the code or request a replacement.
14799
+ * State returned when first-factor authentication requires a one-time code.
14800
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14715
14801
  */
14716
14802
  class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14717
14803
  constructor() {
@@ -14719,8 +14805,7 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14719
14805
  this.stateType = "codeRequired";
14720
14806
  }
14721
14807
  /**
14722
- * Submits the first-factor email code and advances the active flow. The
14723
- * result may complete the operation or require another flow-specific step.
14808
+ * Submits the first-factor code.
14724
14809
  * @param code - The code to submit.
14725
14810
  * @returns The result of submitting the first-factor code.
14726
14811
  */
@@ -14731,14 +14816,11 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14731
14816
  const result = await this.submitCodeCore(code);
14732
14817
  const resultType = result.type;
14733
14818
  if (result.type === FLOW_NEW_PASSWORD_REQUIRED_V2) {
14734
- return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
14735
- correlationId: result.correlationId,
14736
- logger,
14737
- config: this.stateParameters.config,
14738
- flowClient: this.stateParameters.flowClient,
14739
- continuationState: result.continuationState,
14740
- cacheClient: this.stateParameters.cacheClient,
14741
- }), undefined, result.continuationState.scenario);
14819
+ const resetPasswordStateTransitionHandler = this.stateParameters.resetPasswordStateTransitionHandler;
14820
+ if (!resetPasswordStateTransitionHandler) {
14821
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Password-reset state transition handler is missing.", correlationId);
14822
+ }
14823
+ return resetPasswordStateTransitionHandler.handleNewPasswordRequired(result, this.stateParameters);
14742
14824
  }
14743
14825
  if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2 ||
14744
14826
  result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
@@ -14746,10 +14828,10 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14746
14828
  if (!signUpStateTransitionHandler) {
14747
14829
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-up state transition handler is missing.", correlationId);
14748
14830
  }
14749
- return signUpStateTransitionHandler.handleVerification(result, {
14831
+ return signUpStateTransitionHandler.handleAttributeSubmission(result, {
14750
14832
  ...this.stateParameters,
14751
14833
  signUpStateTransitionHandler,
14752
- });
14834
+ }, "attribute");
14753
14835
  }
14754
14836
  if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14755
14837
  return new CustomAuthResultV2(new SignInContinuationStateV2({
@@ -14794,8 +14876,7 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14794
14876
  }
14795
14877
  }
14796
14878
  /**
14797
- * Requests a replacement first-factor email code. The returned state
14798
- * contains the refreshed challenge metadata.
14879
+ * Requests a replacement first-factor code.
14799
14880
  * @returns The result of requesting a replacement code.
14800
14881
  */
14801
14882
  async resendCode() {
@@ -14812,6 +14893,8 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14812
14893
  cacheClient: this.stateParameters.cacheClient,
14813
14894
  signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
14814
14895
  signInStateTransitionHandler: this.stateParameters.signInStateTransitionHandler,
14896
+ resetPasswordStateTransitionHandler: this.stateParameters
14897
+ .resetPasswordStateTransitionHandler,
14815
14898
  method: this.method,
14816
14899
  sentTo: result.sentTo,
14817
14900
  channel: result.channel,
@@ -14833,8 +14916,9 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14833
14916
  * Licensed under the MIT License.
14834
14917
  */
14835
14918
  /**
14836
- * State returned when sign-in requires verification of an email or SMS MFA
14919
+ * State returned when authentication requires verification of an email or SMS MFA
14837
14920
  * challenge. It allows the app to submit the challenge or request a replacement.
14921
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14838
14922
  */
14839
14923
  class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14840
14924
  constructor() {
@@ -14843,7 +14927,6 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14843
14927
  }
14844
14928
  /**
14845
14929
  * Submits the email or SMS challenge as the second authentication factor.
14846
- * Successful verification completes sign-in.
14847
14930
  * @param challenge - The challenge value to submit.
14848
14931
  * @returns The result of submitting the MFA challenge.
14849
14932
  */
@@ -14852,6 +14935,16 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14852
14935
  try {
14853
14936
  logger.verbose("10k0lc", correlationId);
14854
14937
  const result = await this.submitCodeCore(challenge, AuthenticationFactorV2.MULTI_FACTOR);
14938
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14939
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
14940
+ correlationId: result.correlationId,
14941
+ logger,
14942
+ config: this.stateParameters.config,
14943
+ flowClient: this.stateParameters.flowClient,
14944
+ continuationState: result.continuationState,
14945
+ cacheClient: this.stateParameters.cacheClient,
14946
+ }), undefined, result.continuationState.scenario);
14947
+ }
14855
14948
  if (result.type !== FLOW_COMPLETED_V2) {
14856
14949
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
14857
14950
  }
@@ -14863,12 +14956,12 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14863
14956
  return CustomAuthResultV2.createWithError(error, {
14864
14957
  scenario: continuationState.scenario,
14865
14958
  correlationId,
14959
+ errorContext: "mfaVerification",
14866
14960
  });
14867
14961
  }
14868
14962
  }
14869
14963
  /**
14870
- * Requests a replacement challenge for the selected MFA method. The
14871
- * returned state contains the refreshed email or SMS challenge metadata.
14964
+ * Requests a replacement challenge for the selected MFA method.
14872
14965
  * @returns The result of requesting a replacement MFA challenge.
14873
14966
  */
14874
14967
  async resendChallenge() {
@@ -14899,15 +14992,157 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14899
14992
  }
14900
14993
  }
14901
14994
 
14995
+ /*
14996
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14997
+ * Licensed under the MIT License.
14998
+ */
14999
+ function handleExistingAccountVerificationResultV2(result, stateParameters) {
15000
+ const commonStateParameters = {
15001
+ correlationId: result.correlationId,
15002
+ logger: stateParameters.logger,
15003
+ config: stateParameters.config,
15004
+ flowClient: stateParameters.flowClient,
15005
+ continuationState: "continuationState" in result
15006
+ ? result.continuationState
15007
+ : stateParameters.continuationState,
15008
+ cacheClient: stateParameters.cacheClient,
15009
+ };
15010
+ if (result.type === FLOW_COMPLETED_V2) {
15011
+ const account = new CustomAuthAccountData(result.authenticationResult.account, stateParameters.config, stateParameters.cacheClient, stateParameters.logger, result.correlationId);
15012
+ return new CustomAuthResultV2(new CompletedStateV2(), account, stateParameters.continuationState.scenario);
15013
+ }
15014
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15015
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15016
+ ...commonStateParameters,
15017
+ continuationState: result.continuationState,
15018
+ methods: result.methods,
15019
+ }), undefined, result.continuationState.scenario);
15020
+ }
15021
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
15022
+ const signInStateTransitionHandler = stateParameters.signInStateTransitionHandler;
15023
+ if (!signInStateTransitionHandler) {
15024
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-in state transition handler is missing.", stateParameters.correlationId);
15025
+ }
15026
+ return signInStateTransitionHandler.handleMfaRequired(result, stateParameters);
15027
+ }
15028
+ const resultType = result.type;
15029
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account verification result type '${resultType}' is not supported.`, stateParameters.correlationId);
15030
+ }
15031
+
14902
15032
  /*
14903
15033
  * Copyright (c) Microsoft Corporation. All rights reserved.
14904
15034
  * Licensed under the MIT License.
14905
15035
  */
14906
15036
  /**
14907
- * State returned when the user must select one of several authentication
14908
- * methods before a challenge can be issued. It exposes the list of offered
14909
- * methods and lets the app request a challenge for the chosen one. The flow
14910
- * stays on this state until a challenge is successfully requested.
15037
+ * State returned when sign-up discovers an existing account that requires an
15038
+ * email code. Submitting or resending the code preserves existing-account authentication.
15039
+ */
15040
+ class ExistingAccountCodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
15041
+ constructor() {
15042
+ super(...arguments);
15043
+ this.stateType = "existingAccountCodeRequired";
15044
+ }
15045
+ /**
15046
+ * Submits the existing account's email code and continues authentication.
15047
+ * The result can complete authentication or require enrollment or MFA.
15048
+ * @param code - The email code to verify.
15049
+ * @returns The next existing-account authentication result.
15050
+ */
15051
+ async submitCode(code) {
15052
+ const { correlationId, logger, continuationState } = this.stateParameters;
15053
+ try {
15054
+ const result = await this.submitCodeCore(code);
15055
+ if (result.type === FLOW_COMPLETED_V2 ||
15056
+ result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 ||
15057
+ result.type === FLOW_MFA_REQUIRED_V2) {
15058
+ return handleExistingAccountVerificationResultV2(result, this.stateParameters);
15059
+ }
15060
+ const resultType = result.type;
15061
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account code submission result type '${resultType}' is not supported.`, correlationId);
15062
+ }
15063
+ catch (error) {
15064
+ logger.errorPii(`18e4gg ${error}`, correlationId);
15065
+ return CustomAuthResultV2.createWithError(error, {
15066
+ scenario: continuationState.scenario,
15067
+ correlationId,
15068
+ });
15069
+ }
15070
+ }
15071
+ /**
15072
+ * Requests a replacement email code for the existing account. The returned
15073
+ * state contains the fresh continuation token and challenge metadata.
15074
+ * @returns The refreshed existing-account code state or an error.
15075
+ */
15076
+ async resendCode() {
15077
+ const { correlationId, logger, continuationState } = this.stateParameters;
15078
+ try {
15079
+ const result = await this.resendCodeCore();
15080
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
15081
+ ...this.stateParameters,
15082
+ correlationId: result.correlationId,
15083
+ continuationState: result.continuationState,
15084
+ sentTo: result.sentTo,
15085
+ channel: result.channel,
15086
+ codeLength: result.codeLength,
15087
+ }), undefined, result.continuationState.scenario);
15088
+ }
15089
+ catch (error) {
15090
+ logger.errorPii(`011v0m ${error}`, correlationId);
15091
+ return CustomAuthResultV2.createWithError(error, {
15092
+ scenario: continuationState.scenario,
15093
+ correlationId,
15094
+ });
15095
+ }
15096
+ }
15097
+ }
15098
+
15099
+ /*
15100
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15101
+ * Licensed under the MIT License.
15102
+ */
15103
+ /**
15104
+ * State returned when sign-up discovers an existing account that requires its
15105
+ * current password. The password is verified as an authentication credential.
15106
+ */
15107
+ class ExistingAccountPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15108
+ constructor() {
15109
+ super(...arguments);
15110
+ this.stateType = "existingAccountPasswordRequired";
15111
+ }
15112
+ /**
15113
+ * Verifies the existing account's current password and continues authentication.
15114
+ * The result can complete authentication or require enrollment or MFA.
15115
+ * @param password - The existing account password.
15116
+ * @returns The next existing-account authentication result.
15117
+ */
15118
+ async submitPassword(password) {
15119
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15120
+ try {
15121
+ this.ensurePasswordIsNotEmpty(password);
15122
+ const result = await flowClient.submitSignInPassword({
15123
+ correlationId,
15124
+ continuationState,
15125
+ password,
15126
+ });
15127
+ return handleExistingAccountVerificationResultV2(result, this.stateParameters);
15128
+ }
15129
+ catch (error) {
15130
+ logger.errorPii(`1glycw ${error}`, correlationId);
15131
+ return CustomAuthResultV2.createWithError(error, {
15132
+ scenario: continuationState.scenario,
15133
+ correlationId,
15134
+ });
15135
+ }
15136
+ }
15137
+ }
15138
+
15139
+ /*
15140
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15141
+ * Licensed under the MIT License.
15142
+ */
15143
+ /**
15144
+ * State returned when the user must select an authentication method.
15145
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14911
15146
  */
14912
15147
  class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14913
15148
  constructor(stateParameters) {
@@ -14916,13 +15151,12 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
14916
15151
  this.methods = stateParameters.methods;
14917
15152
  }
14918
15153
  /**
14919
- * Selects an authentication method and requests its challenge. The returned
14920
- * state identifies the credential the application must collect.
15154
+ * Selects an authentication method and requests its challenge.
14921
15155
  * @param method - The method to select, from {@link methods}.
14922
15156
  * @returns The result of selecting the method and requesting its challenge.
14923
15157
  */
14924
15158
  async selectAuthMethod(method) {
14925
- const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, } = this.stateParameters;
15159
+ const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, resetPasswordStateTransitionHandler, } = this.stateParameters;
14926
15160
  try {
14927
15161
  logger.verbose("1r2ypl", correlationId);
14928
15162
  const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
@@ -14933,22 +15167,45 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
14933
15167
  flowClient,
14934
15168
  continuationState: result.continuationState,
14935
15169
  cacheClient: this.stateParameters.cacheClient,
15170
+ signInStateTransitionHandler,
14936
15171
  };
14937
- if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15172
+ const isExistingAccountSignUp = continuationState.scenario ===
15173
+ CustomAuthFlowScenarioV2.SignUp &&
15174
+ continuationState.signUp?.purpose === "existingAccount";
15175
+ const channel = result.type === FLOW_CODE_REQUIRED_V2
15176
+ ? result.channel?.toLowerCase()
15177
+ : undefined;
15178
+ if (isExistingAccountSignUp &&
15179
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
14938
15180
  result.type === FLOW_CODE_REQUIRED_V2 &&
14939
- (result.channel?.toLowerCase() ===
14940
- AuthenticationMethodTypeV2.EMAIL ||
14941
- result.channel?.toLowerCase() ===
14942
- AuthenticationMethodTypeV2.SMS)) {
15181
+ channel === AuthenticationMethodTypeV2.EMAIL) {
15182
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
15183
+ ...commonStateParameters,
15184
+ method: selectedMethod,
15185
+ sentTo: result.sentTo,
15186
+ channel: result.channel,
15187
+ codeLength: result.codeLength,
15188
+ }), undefined, result.continuationState.scenario);
15189
+ }
15190
+ if (!isExistingAccountSignUp &&
15191
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15192
+ result.type === FLOW_CODE_REQUIRED_V2 &&
15193
+ (channel === AuthenticationMethodTypeV2.EMAIL ||
15194
+ channel === AuthenticationMethodTypeV2.SMS)) {
14943
15195
  return new CustomAuthResultV2(new CodeRequiredStateV2({
14944
15196
  ...commonStateParameters,
14945
- signInStateTransitionHandler,
15197
+ resetPasswordStateTransitionHandler,
14946
15198
  method: selectedMethod,
14947
15199
  sentTo: result.sentTo,
14948
15200
  channel: result.channel,
14949
15201
  codeLength: result.codeLength,
14950
15202
  }), undefined, result.continuationState.scenario);
14951
15203
  }
15204
+ if (isExistingAccountSignUp &&
15205
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15206
+ result.type === FLOW_PASSWORD_REQUIRED_V2) {
15207
+ return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2(commonStateParameters), undefined, result.continuationState.scenario);
15208
+ }
14952
15209
  if (continuationState.scenario ===
14953
15210
  CustomAuthFlowScenarioV2.SignIn &&
14954
15211
  authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
@@ -14968,12 +15225,17 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
14968
15225
  codeLength: result.codeLength,
14969
15226
  }), undefined, result.continuationState.scenario);
14970
15227
  }
14971
- const expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
15228
+ let expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
14972
15229
  ? continuationState.scenario ===
14973
15230
  CustomAuthFlowScenarioV2.SignIn
14974
15231
  ? "an email or SMS code challenge or a password challenge for single-factor sign-in"
14975
15232
  : "an email or SMS code challenge for single-factor authentication"
14976
15233
  : "a code challenge for multi-factor authentication";
15234
+ if (isExistingAccountSignUp &&
15235
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR) {
15236
+ expectedChallenge =
15237
+ "an email code challenge or a password challenge for existing-account sign-up";
15238
+ }
14977
15239
  const returnedChallenge = result.type === FLOW_CODE_REQUIRED_V2
14978
15240
  ? result.channel
14979
15241
  ? `a '${result.channel}' code challenge`
@@ -14989,24 +15251,143 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
14989
15251
  });
14990
15252
  }
14991
15253
  }
14992
- async requestSelectedMethodChallenge(method) {
14993
- const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
14994
- const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
14995
- if (!selectedMethod) {
14996
- throw new InvalidArgumentError("method", correlationId);
14997
- }
14998
- const result = await flowClient.requestChallenge({
14999
- correlationId,
15000
- authenticationFactor,
15001
- continuationState: {
15002
- ...continuationState,
15003
- links: {
15004
- ...continuationState.links,
15005
- challenge: selectedMethod.challengeHref,
15006
- },
15007
- },
15008
- });
15009
- return { result, selectedMethod };
15254
+ async requestSelectedMethodChallenge(method) {
15255
+ const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
15256
+ const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
15257
+ if (!selectedMethod) {
15258
+ throw new InvalidArgumentError("method", correlationId);
15259
+ }
15260
+ const result = await flowClient.requestChallenge({
15261
+ correlationId,
15262
+ authenticationFactor,
15263
+ continuationState: {
15264
+ ...continuationState,
15265
+ links: {
15266
+ ...continuationState.links,
15267
+ challenge: selectedMethod.challengeHref,
15268
+ },
15269
+ },
15270
+ });
15271
+ return { result, selectedMethod };
15272
+ }
15273
+ }
15274
+
15275
+ /*
15276
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15277
+ * Licensed under the MIT License.
15278
+ */
15279
+ /**
15280
+ * State returned when sign-in or sign-up requires a password.
15281
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15282
+ */
15283
+ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15284
+ constructor(stateParameters) {
15285
+ super(stateParameters);
15286
+ this.stateType = "passwordRequired";
15287
+ this.requestedPasswordAttribute =
15288
+ stateParameters.requestedPasswordAttribute;
15289
+ }
15290
+ /**
15291
+ * Submits the password and advances the active flow. Use the returned result
15292
+ * to continue the flow.
15293
+ * @param password - The account password.
15294
+ * @returns The result containing the next state or an error.
15295
+ */
15296
+ async submitPassword(password) {
15297
+ const { correlationId, logger, continuationState } = this.stateParameters;
15298
+ try {
15299
+ this.ensurePasswordIsNotEmpty(password);
15300
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
15301
+ return await this.submitSignUpPassword(password);
15302
+ }
15303
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
15304
+ return await this.submitSignInPassword(password);
15305
+ }
15306
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission is not supported for the '${continuationState.scenario}' flow.`, correlationId);
15307
+ }
15308
+ catch (error) {
15309
+ logger.errorPii(`1n12c0 ${error}`, correlationId);
15310
+ return CustomAuthResultV2.createWithError(error, {
15311
+ scenario: continuationState.scenario,
15312
+ correlationId,
15313
+ });
15314
+ }
15315
+ }
15316
+ async submitSignUpPassword(password) {
15317
+ const { correlationId, continuationState, flowClient } = this.stateParameters;
15318
+ const signUpStateTransitionHandler = this.stateParameters.signUpStateTransitionHandler;
15319
+ if (!signUpStateTransitionHandler) {
15320
+ throw new UnexpectedError("Sign-up state transition handler is missing.", correlationId);
15321
+ }
15322
+ const result = await flowClient.submitSignUpAttributes({
15323
+ correlationId,
15324
+ continuationState,
15325
+ attributes: { password },
15326
+ });
15327
+ return signUpStateTransitionHandler.handleAttributeSubmission(result, { ...this.stateParameters, signUpStateTransitionHandler }, "password");
15328
+ }
15329
+ async submitSignInPassword(password) {
15330
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15331
+ const result = await flowClient.submitSignInPassword({
15332
+ correlationId,
15333
+ continuationState,
15334
+ password,
15335
+ });
15336
+ const resultType = result.type;
15337
+ if (result.type === FLOW_COMPLETED_V2) {
15338
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
15339
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
15340
+ }
15341
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15342
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15343
+ correlationId: result.correlationId,
15344
+ logger,
15345
+ config: this.stateParameters.config,
15346
+ flowClient,
15347
+ continuationState: result.continuationState,
15348
+ cacheClient: this.stateParameters.cacheClient,
15349
+ methods: result.methods,
15350
+ }), undefined, result.continuationState.scenario);
15351
+ }
15352
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
15353
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15354
+ correlationId: result.correlationId,
15355
+ logger,
15356
+ config: this.stateParameters.config,
15357
+ flowClient,
15358
+ continuationState: result.continuationState,
15359
+ cacheClient: this.stateParameters.cacheClient,
15360
+ methods: result.methods,
15361
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15362
+ }), undefined, result.continuationState.scenario);
15363
+ }
15364
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
15365
+ }
15366
+ }
15367
+
15368
+ /*
15369
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15370
+ * Licensed under the MIT License.
15371
+ */
15372
+ class SignInStateTransitionHandlerV2 {
15373
+ handlePasswordRequired(result, stateParameters) {
15374
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
15375
+ ...stateParameters,
15376
+ correlationId: result.correlationId,
15377
+ continuationState: result.continuationState,
15378
+ }), undefined, result.continuationState.scenario);
15379
+ }
15380
+ handleMfaRequired(result, stateParameters) {
15381
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15382
+ correlationId: result.correlationId,
15383
+ logger: stateParameters.logger,
15384
+ config: stateParameters.config,
15385
+ flowClient: stateParameters.flowClient,
15386
+ continuationState: result.continuationState,
15387
+ cacheClient: stateParameters.cacheClient,
15388
+ methods: result.methods,
15389
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15390
+ }), undefined, result.continuationState.scenario);
15010
15391
  }
15011
15392
  }
15012
15393
 
@@ -15015,33 +15396,34 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
15015
15396
  * Licensed under the MIT License.
15016
15397
  */
15017
15398
  /**
15018
- * State returned when the selected sign-in method requires the user's
15019
- * password.
15399
+ * State returned when the user must supply a new password. Submission can
15400
+ * require method registration or MFA, and the flow is not complete until any
15401
+ * subsequent required actions finish.
15402
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15020
15403
  */
15021
- class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15404
+ class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15022
15405
  constructor() {
15023
15406
  super(...arguments);
15024
- this.stateType = "passwordRequired";
15407
+ this.stateType = "newPasswordRequired";
15025
15408
  }
15026
15409
  /**
15027
- * Submits the password and advances sign-in.
15028
- * @param password - The account password.
15029
- * @returns A completed sign-in, MFA selection, or password submission error.
15410
+ * Submits the new password. The result can require method registration or
15411
+ * MFA, and completion is not final until any subsequent required actions
15412
+ * finish.
15413
+ * @param password - The new password to set.
15414
+ * @returns The result of submitting the new password.
15030
15415
  */
15031
- async submitPassword(password) {
15416
+ async submitNewPassword(password) {
15032
15417
  const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15033
15418
  try {
15034
15419
  this.ensurePasswordIsNotEmpty(password);
15035
- const result = await flowClient.submitSignInPassword({
15420
+ logger.verbose("0ie1qa", correlationId);
15421
+ const result = await flowClient.submitNewPassword({
15036
15422
  correlationId,
15037
15423
  continuationState,
15038
- password,
15424
+ newPassword: password,
15039
15425
  });
15040
15426
  const resultType = result.type;
15041
- if (result.type === FLOW_COMPLETED_V2) {
15042
- const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
15043
- return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
15044
- }
15045
15427
  if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15046
15428
  return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15047
15429
  correlationId: result.correlationId,
@@ -15065,10 +15447,20 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15065
15447
  authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15066
15448
  }), undefined, result.continuationState.scenario);
15067
15449
  }
15068
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
15450
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
15451
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
15452
+ correlationId: result.correlationId,
15453
+ logger,
15454
+ config: this.stateParameters.config,
15455
+ flowClient,
15456
+ continuationState: result.continuationState,
15457
+ cacheClient: this.stateParameters.cacheClient,
15458
+ }), undefined, result.continuationState.scenario);
15459
+ }
15460
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
15069
15461
  }
15070
15462
  catch (error) {
15071
- logger.errorPii(`0qvjzk ${error}`, correlationId);
15463
+ logger.errorPii(`03m081 ${error}`, correlationId);
15072
15464
  return CustomAuthResultV2.createWithError(error, {
15073
15465
  scenario: continuationState.scenario,
15074
15466
  correlationId,
@@ -15081,66 +15473,46 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15081
15473
  * Copyright (c) Microsoft Corporation. All rights reserved.
15082
15474
  * Licensed under the MIT License.
15083
15475
  */
15084
- class SignInStateTransitionHandlerV2 {
15085
- handlePasswordRequired(result, stateParameters) {
15086
- return new CustomAuthResultV2(new PasswordRequiredStateV2({
15087
- ...stateParameters,
15088
- correlationId: result.correlationId,
15089
- continuationState: result.continuationState,
15090
- }), undefined, result.continuationState.scenario);
15091
- }
15092
- handleMfaRequired(result, stateParameters) {
15093
- return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15476
+ class ResetPasswordStateTransitionHandlerV2 {
15477
+ handleNewPasswordRequired(result, stateParameters) {
15478
+ return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
15094
15479
  correlationId: result.correlationId,
15095
15480
  logger: stateParameters.logger,
15096
15481
  config: stateParameters.config,
15097
15482
  flowClient: stateParameters.flowClient,
15098
15483
  continuationState: result.continuationState,
15099
15484
  cacheClient: stateParameters.cacheClient,
15100
- methods: result.methods,
15101
- authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15102
15485
  }), undefined, result.continuationState.scenario);
15103
15486
  }
15104
15487
  }
15105
15488
 
15106
- /*
15107
- * Copyright (c) Microsoft Corporation. All rights reserved.
15108
- * Licensed under the MIT License.
15109
- */
15110
- class SignUpAttributesRequiredStateBaseV2 extends AuthFlowActionRequiredStateBase {
15111
- constructor(stateParameters) {
15112
- super(stateParameters);
15113
- this.attributes = stateParameters.attributes;
15114
- }
15115
- async submitAttributesAction(attributes) {
15116
- const { correlationId, continuationState, flowClient } = this.stateParameters;
15117
- return flowClient.submitSignUpAttributes({
15118
- correlationId,
15119
- continuationState,
15120
- attributes,
15121
- });
15122
- }
15123
- }
15124
-
15125
15489
  /*
15126
15490
  * Copyright (c) Microsoft Corporation. All rights reserved.
15127
15491
  * Licensed under the MIT License.
15128
15492
  */
15129
15493
  /**
15130
15494
  * State returned when sign-up requires profile or custom attributes.
15495
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15131
15496
  */
15132
- class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
15133
- constructor() {
15134
- super(...arguments);
15497
+ class AttributesRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15498
+ constructor(stateParameters) {
15499
+ super(stateParameters);
15135
15500
  this.stateType = "attributesRequired";
15501
+ this.attributes = stateParameters.attributes;
15136
15502
  }
15137
15503
  /**
15138
- * Submits the attributes requested by the latest server response.
15504
+ * Submits the supplied attributes, including an empty object, to the service.
15505
+ * The returned result identifies the next step or a submission failure.
15139
15506
  */
15140
15507
  async submitAttributes(attributes) {
15141
- const { correlationId, logger, continuationState } = this.stateParameters;
15508
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15142
15509
  try {
15143
- const result = await this.submitAttributesAction(attributes);
15510
+ const filteredAttributes = filterReservedSignUpAttributesV2(attributes, logger, correlationId);
15511
+ const result = await flowClient.submitSignUpAttributes({
15512
+ correlationId,
15513
+ continuationState,
15514
+ attributes: filteredAttributes,
15515
+ });
15144
15516
  return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "attribute");
15145
15517
  }
15146
15518
  catch (error) {
@@ -15157,53 +15529,23 @@ class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
15157
15529
  * Copyright (c) Microsoft Corporation. All rights reserved.
15158
15530
  * Licensed under the MIT License.
15159
15531
  */
15160
- /**
15161
- * State returned when sign-up requires a password that was not submitted with
15162
- * an earlier attribute request.
15163
- */
15164
- class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
15165
- constructor(stateParameters) {
15166
- super(stateParameters);
15167
- this.stateType = "passwordRequired";
15168
- this.requiredPasswordAttribute =
15169
- stateParameters.requiredPasswordAttribute;
15170
- }
15532
+ class SignUpStateTransitionHandlerV2 {
15171
15533
  /**
15172
- * Submits the password and any profile attributes requested alongside it.
15534
+ * Maps new-account verification and attribute-submission outcomes to public states.
15173
15535
  */
15174
- async submitPassword(password, attributes = {}) {
15175
- const { correlationId, logger, continuationState } = this.stateParameters;
15176
- try {
15177
- this.ensurePasswordIsNotEmpty(password);
15178
- const result = await this.submitAttributesAction({
15179
- ...attributes,
15180
- password,
15181
- });
15182
- return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "password");
15183
- }
15184
- catch (error) {
15185
- logger.errorPii(`07t30r ${error}`, correlationId);
15186
- return CustomAuthResultV2.createWithError(error, {
15187
- scenario: continuationState.scenario,
15188
- correlationId,
15189
- });
15190
- }
15191
- }
15192
- }
15193
-
15194
- /*
15195
- * Copyright (c) Microsoft Corporation. All rights reserved.
15196
- * Licensed under the MIT License.
15197
- */
15198
- class SignUpStateTransitionHandlerV2 {
15199
15536
  handleAttributeSubmission(result, stateParameters, submission) {
15537
+ const resultType = result.type;
15200
15538
  const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
15201
- if (result.type === FLOW_CODE_REQUIRED_V2) {
15202
- return new CustomAuthResultV2(new CodeRequiredStateV2({
15539
+ if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
15540
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
15203
15541
  ...commonStateParameters,
15204
- sentTo: result.sentTo,
15205
- channel: result.channel,
15206
- codeLength: result.codeLength,
15542
+ requestedPasswordAttribute: result.requestedPasswordAttribute,
15543
+ }), undefined, result.continuationState.scenario);
15544
+ }
15545
+ if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
15546
+ return new CustomAuthResultV2(new AttributesRequiredStateV2({
15547
+ ...commonStateParameters,
15548
+ attributes: result.attributes,
15207
15549
  }), undefined, result.continuationState.scenario);
15208
15550
  }
15209
15551
  if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
@@ -15215,21 +15557,7 @@ class SignUpStateTransitionHandlerV2 {
15215
15557
  methods: result.methods,
15216
15558
  }), undefined, result.continuationState.scenario);
15217
15559
  }
15218
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
15219
- }
15220
- handleVerification(result, stateParameters) {
15221
- const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
15222
- if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
15223
- return new CustomAuthResultV2(new AttributesRequiredStateV2({
15224
- ...commonStateParameters,
15225
- attributes: result.attributes,
15226
- }), undefined, result.continuationState.scenario);
15227
- }
15228
- return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
15229
- ...commonStateParameters,
15230
- attributes: result.attributes,
15231
- requiredPasswordAttribute: result.requiredPasswordAttribute,
15232
- }), undefined, result.continuationState.scenario);
15560
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${resultType}' is not supported.`, stateParameters.correlationId);
15233
15561
  }
15234
15562
  createCommonStateParameters(result, stateParameters) {
15235
15563
  return {
@@ -21353,37 +21681,38 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21353
21681
  }, e);
21354
21682
  throw e;
21355
21683
  }
21356
- // check if the tokens can be retrieved from internal cache
21357
- let cachedResult;
21358
- try {
21359
- cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
21360
- }
21361
- catch (e) {
21362
- if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
21363
- this.logger.info("0eitbc", this.correlationId);
21684
+ if (this.apiId === ApiId.acquireTokenSilent_silentFlow) {
21685
+ let cachedResult;
21686
+ try {
21687
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest, cacheLookupPolicy);
21688
+ }
21689
+ catch (e) {
21690
+ if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
21691
+ this.logger.info("0eitbc", this.correlationId);
21692
+ nativeATMeasurement.add({
21693
+ isNativeBroker: false,
21694
+ });
21695
+ nativeATMeasurement.end({
21696
+ success: false,
21697
+ });
21698
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21699
+ throw e;
21700
+ }
21701
+ // continue with a native call for any and all errors
21702
+ this.logger.info("0957j1", this.correlationId);
21703
+ }
21704
+ if (cachedResult) {
21705
+ // Served from the native internal cache; token did not come directly from the broker
21364
21706
  nativeATMeasurement.add({
21365
21707
  isNativeBroker: false,
21366
21708
  });
21367
21709
  nativeATMeasurement.end({
21368
- success: false,
21710
+ success: true,
21711
+ fromCache: true,
21369
21712
  });
21370
- await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21371
- throw e;
21713
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
21714
+ return cachedResult;
21372
21715
  }
21373
- // continue with a native call for any and all errors
21374
- this.logger.info("0957j1", this.correlationId);
21375
- }
21376
- if (cachedResult) {
21377
- // Served from the native internal cache; token did not come directly from the broker
21378
- nativeATMeasurement.add({
21379
- isNativeBroker: false,
21380
- });
21381
- nativeATMeasurement.end({
21382
- success: true,
21383
- fromCache: true,
21384
- });
21385
- await this.resetGeneratedDpopRequestKey(nativeRequest);
21386
- return cachedResult;
21387
21716
  }
21388
21717
  // dispatch the request to the broker
21389
21718
  try {
@@ -21474,12 +21803,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21474
21803
  };
21475
21804
  }
21476
21805
  /**
21477
- * Fetches the tokens from the cache if un-expired
21806
+ * Fetches unexpired tokens when allowed by cache policy.
21478
21807
  * @param nativeAccountId
21479
21808
  * @param request
21480
- * @returns authenticationResult
21809
+ * @param cacheLookupPolicy
21810
+ * @returns Cached result, or undefined when cache policy bypasses lookup.
21481
21811
  */
21482
- async acquireTokensFromCache(nativeAccountId, request) {
21812
+ async acquireTokensFromCache(nativeAccountId, request, cacheLookupPolicy = CacheLookupPolicy.Default) {
21813
+ if (cacheLookupPolicy === CacheLookupPolicy.RefreshTokenAndNetwork ||
21814
+ cacheLookupPolicy === CacheLookupPolicy.Skip) {
21815
+ this.logger.verbose("03uwyk", this.correlationId);
21816
+ return undefined;
21817
+ }
21483
21818
  if (!nativeAccountId) {
21484
21819
  this.logger.warning("1ndf3e", this.correlationId);
21485
21820
  throw createClientAuthError(noAccountFound, this.correlationId);
@@ -21829,7 +22164,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21829
22164
  async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
21830
22165
  // Store the account info and hence `nativeAccountId` in browser cache
21831
22166
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
21832
- // Remove any existing cached tokens for this account in browser storage
22167
+ // Remove cached web access and refresh tokens, preserving ID tokens.
21833
22168
  if (clearExistingTokens) {
21834
22169
  this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
21835
22170
  }
@@ -27114,6 +27449,7 @@ class CustomAuthStandardController extends StandardController {
27114
27449
  super(operatingContext);
27115
27450
  this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
27116
27451
  this.signInStateTransitionHandlerV2 = new SignInStateTransitionHandlerV2();
27452
+ this.resetPasswordStateTransitionHandlerV2 = new ResetPasswordStateTransitionHandlerV2();
27117
27453
  if (!this.isBrowserEnvironment) {
27118
27454
  this.logger.verbose("1f7i3q", "");
27119
27455
  throw new UnsupportedEnvironmentError();
@@ -27390,7 +27726,7 @@ class CustomAuthStandardController extends StandardController {
27390
27726
  const correlationId = this.getCorrelationId(inputs);
27391
27727
  try {
27392
27728
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27393
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27729
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27394
27730
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27395
27731
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27396
27732
  }
@@ -27414,6 +27750,7 @@ class CustomAuthStandardController extends StandardController {
27414
27750
  flowClient: this.flowClientV2,
27415
27751
  continuationState: result.continuationState,
27416
27752
  cacheClient: this.cacheClient,
27753
+ resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
27417
27754
  method: result.method,
27418
27755
  sentTo: result.sentTo,
27419
27756
  channel: result.channel,
@@ -27429,6 +27766,7 @@ class CustomAuthStandardController extends StandardController {
27429
27766
  cacheClient: this.cacheClient,
27430
27767
  methods: result.methods,
27431
27768
  authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
27769
+ resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
27432
27770
  }), undefined, result.continuationState.scenario);
27433
27771
  }
27434
27772
  catch (error) {
@@ -27443,7 +27781,7 @@ class CustomAuthStandardController extends StandardController {
27443
27781
  const correlationId = this.getCorrelationId(inputs);
27444
27782
  try {
27445
27783
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27446
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27784
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27447
27785
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27448
27786
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27449
27787
  }
@@ -27455,13 +27793,9 @@ class CustomAuthStandardController extends StandardController {
27455
27793
  const result = await this.flowClientV2.signIn({
27456
27794
  correlationId,
27457
27795
  username: inputs.username,
27458
- password: inputs.password,
27459
27796
  scopes: inputs.scopes,
27460
27797
  claims: inputs.claims,
27461
27798
  });
27462
- if (result.type === FLOW_COMPLETED_V2) {
27463
- return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
27464
- }
27465
27799
  if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
27466
27800
  return new CustomAuthResultV2(new PasswordRequiredStateV2({
27467
27801
  correlationId: result.correlationId,
@@ -27472,17 +27806,6 @@ class CustomAuthStandardController extends StandardController {
27472
27806
  cacheClient: this.cacheClient,
27473
27807
  }), undefined, result.continuationState.scenario);
27474
27808
  }
27475
- if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
27476
- return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
27477
- correlationId: result.correlationId,
27478
- logger: this.logger,
27479
- config: this.customAuthConfig,
27480
- flowClient: this.flowClientV2,
27481
- continuationState: result.continuationState,
27482
- cacheClient: this.cacheClient,
27483
- methods: result.methods,
27484
- }), undefined, result.continuationState.scenario);
27485
- }
27486
27809
  if (result.type === FLOW_CODE_REQUIRED_V2) {
27487
27810
  return new CustomAuthResultV2(new CodeRequiredStateV2({
27488
27811
  correlationId: result.correlationId,
@@ -27511,18 +27834,6 @@ class CustomAuthStandardController extends StandardController {
27511
27834
  signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27512
27835
  }), undefined, result.continuationState.scenario);
27513
27836
  }
27514
- if (result.type === FLOW_MFA_REQUIRED_V2) {
27515
- return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
27516
- correlationId: result.correlationId,
27517
- logger: this.logger,
27518
- config: this.customAuthConfig,
27519
- flowClient: this.flowClientV2,
27520
- continuationState: result.continuationState,
27521
- cacheClient: this.cacheClient,
27522
- methods: result.methods,
27523
- authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
27524
- }), undefined, result.continuationState.scenario);
27525
- }
27526
27837
  throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
27527
27838
  }
27528
27839
  catch (error) {
@@ -27537,11 +27848,7 @@ class CustomAuthStandardController extends StandardController {
27537
27848
  const correlationId = this.getCorrelationId(inputs);
27538
27849
  try {
27539
27850
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27540
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27541
- if (Object.prototype.hasOwnProperty.call(inputs, "password")) {
27542
- ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
27543
- ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
27544
- }
27851
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27545
27852
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27546
27853
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27547
27854
  }
@@ -27553,39 +27860,61 @@ class CustomAuthStandardController extends StandardController {
27553
27860
  const result = await this.flowClientV2.signUp({
27554
27861
  correlationId,
27555
27862
  username: inputs.username,
27556
- password: inputs.password,
27557
- attributes: inputs.attributes,
27558
27863
  scopes: inputs.scopes,
27559
27864
  claims: inputs.claims,
27865
+ attributes: inputs.attributes,
27560
27866
  });
27561
- const commonStateParameters = {
27562
- correlationId: result.correlationId,
27563
- logger: this.logger,
27564
- config: this.customAuthConfig,
27565
- flowClient: this.flowClientV2,
27566
- continuationState: result.continuationState,
27567
- cacheClient: this.cacheClient,
27568
- signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
27569
- };
27570
27867
  if (result.type === FLOW_CODE_REQUIRED_V2) {
27571
27868
  return new CustomAuthResultV2(new CodeRequiredStateV2({
27572
- ...commonStateParameters,
27869
+ correlationId: result.correlationId,
27870
+ logger: this.logger,
27871
+ config: this.customAuthConfig,
27872
+ flowClient: this.flowClientV2,
27873
+ continuationState: result.continuationState,
27874
+ cacheClient: this.cacheClient,
27875
+ signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
27573
27876
  sentTo: result.sentTo,
27574
27877
  channel: result.channel,
27575
27878
  codeLength: result.codeLength,
27576
27879
  }), undefined, result.continuationState.scenario);
27577
27880
  }
27578
- if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
27579
- return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
27580
- ...commonStateParameters,
27581
- attributes: result.attributes,
27582
- requiredPasswordAttribute: result.requiredPasswordAttribute,
27881
+ if (result.type === FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2) {
27882
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
27883
+ correlationId: result.correlationId,
27884
+ logger: this.logger,
27885
+ config: this.customAuthConfig,
27886
+ flowClient: this.flowClientV2,
27887
+ continuationState: result.continuationState,
27888
+ cacheClient: this.cacheClient,
27889
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27890
+ method: result.method,
27891
+ sentTo: result.sentTo,
27892
+ channel: result.channel,
27893
+ codeLength: result.codeLength,
27583
27894
  }), undefined, result.continuationState.scenario);
27584
27895
  }
27585
- if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
27586
- return new CustomAuthResultV2(new AttributesRequiredStateV2({
27587
- ...commonStateParameters,
27588
- attributes: result.attributes,
27896
+ if (result.type === FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2) {
27897
+ return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2({
27898
+ correlationId: result.correlationId,
27899
+ logger: this.logger,
27900
+ config: this.customAuthConfig,
27901
+ flowClient: this.flowClientV2,
27902
+ continuationState: result.continuationState,
27903
+ cacheClient: this.cacheClient,
27904
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27905
+ }), undefined, result.continuationState.scenario);
27906
+ }
27907
+ if (result.type === FLOW_METHOD_SELECTION_REQUIRED_V2) {
27908
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
27909
+ correlationId: result.correlationId,
27910
+ logger: this.logger,
27911
+ config: this.customAuthConfig,
27912
+ flowClient: this.flowClientV2,
27913
+ continuationState: result.continuationState,
27914
+ cacheClient: this.cacheClient,
27915
+ methods: result.methods,
27916
+ authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
27917
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27589
27918
  }), undefined, result.continuationState.scenario);
27590
27919
  }
27591
27920
  throw new UnexpectedError("Unsupported native auth V2 sign-up result type.", correlationId);
@@ -27598,6 +27927,9 @@ class CustomAuthStandardController extends StandardController {
27598
27927
  });
27599
27928
  }
27600
27929
  }
27930
+ ensureUsernameIsValidV2(username, correlationId) {
27931
+ ensureArgumentIsNotEmptyString("inputs.username", username, correlationId);
27932
+ }
27601
27933
  getCorrelationId(actionInputs) {
27602
27934
  return (actionInputs?.correlationId || this.browserCrypto.createNewGuid());
27603
27935
  }
@@ -28571,8 +28903,8 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
28571
28903
  return this.customAuthController.resetPassword(resetPasswordInputs);
28572
28904
  }
28573
28905
  /**
28574
- * Starts native auth V2 sign-in and returns the authentication methods
28575
- * offered for the first factor.
28906
+ * Starts native auth V2 sign-in.
28907
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28576
28908
  * @param inputs - Inputs for the sign-in V2 flow.
28577
28909
  * @returns A promise that resolves to the sign-in start result.
28578
28910
  */
@@ -28581,6 +28913,7 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
28581
28913
  }
28582
28914
  /**
28583
28915
  * Starts native auth V2 sign-up.
28916
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28584
28917
  * @param inputs - Inputs for the sign-up V2 flow.
28585
28918
  * @returns A promise that resolves to the sign-up start result.
28586
28919
  */
@@ -28588,7 +28921,8 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
28588
28921
  return this.customAuthController.signUpV2(inputs);
28589
28922
  }
28590
28923
  /**
28591
- * Initiates the native auth V2 self-service password reset flow.
28924
+ * Starts native auth V2 self-service password reset.
28925
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28592
28926
  * @param {ResetPasswordInputsV2} inputs - Inputs for the reset-password V2 flow
28593
28927
  * @returns {Promise<ResetPasswordStartResultV2>} - A promise that resolves to ResetPasswordStartResultV2
28594
28928
  */
@@ -28657,6 +28991,8 @@ exports.CustomAuthError = CustomAuthError;
28657
28991
  exports.CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2;
28658
28992
  exports.CustomAuthPublicClientApplication = CustomAuthPublicClientApplication;
28659
28993
  exports.CustomAuthResultV2 = CustomAuthResultV2;
28994
+ exports.ExistingAccountCodeRequiredStateV2 = ExistingAccountCodeRequiredStateV2;
28995
+ exports.ExistingAccountPasswordRequiredStateV2 = ExistingAccountPasswordRequiredStateV2;
28660
28996
  exports.FailedStateV2 = FailedStateV2;
28661
28997
  exports.GetAccessTokenResult = GetAccessTokenResult;
28662
28998
  exports.GetAccountError = GetAccountError;
@@ -28716,7 +29052,6 @@ exports.SignUpCompletedState = SignUpCompletedState;
28716
29052
  exports.SignUpError = SignUpError;
28717
29053
  exports.SignUpFailedState = SignUpFailedState;
28718
29054
  exports.SignUpPasswordRequiredState = SignUpPasswordRequiredState;
28719
- exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
28720
29055
  exports.SignUpResendCodeError = SignUpResendCodeError;
28721
29056
  exports.SignUpResendCodeResult = SignUpResendCodeResult;
28722
29057
  exports.SignUpResult = SignUpResult;