@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
@@ -26,6 +26,8 @@ import {
26
26
  import {
27
27
  createFlowMethodSelectionRequiredResultV2,
28
28
  createFlowCodeRequiredResultV2,
29
+ createFlowExistingAccountCodeRequiredResultV2,
30
+ createFlowExistingAccountPasswordRequiredResultV2,
29
31
  createFlowPasswordRequiredResultV2,
30
32
  createFlowSignUpPasswordRequiredResultV2,
31
33
  createFlowMFARequiredResultV2,
@@ -36,21 +38,21 @@ import {
36
38
  createFlowAuthMethodRegistrationRequiredResultV2,
37
39
  createFlowAuthMethodVerificationRequiredResultV2,
38
40
  FLOW_CODE_REQUIRED_V2,
39
- FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2,
40
- FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2,
41
+ FLOW_PASSWORD_REQUIRED_V2,
41
42
  } from "./result/FlowActionResultV2.js";
42
43
  import type {
43
- FlowMethodSelectionRequiredResultV2,
44
44
  FlowCodeRequiredResultV2,
45
- FlowSignInCodeRequiredResultV2,
46
- FlowResetPasswordCodeRequiredResultV2,
47
- FlowPasswordRequiredResultV2,
48
- FlowSignUpPasswordRequiredResultV2,
49
- FlowMFARequiredResultV2,
50
- FlowAttributesRequiredResultV2,
51
- FlowSignInContinuationRequiredResultV2,
45
+ FlowExistingAccountChallengeResultV2,
52
46
  FlowCompletedResultV2,
53
- FlowSignUpActionResultV2,
47
+ FlowSignInContinuationRequiredResultV2,
48
+ FlowSignInStartResultV2,
49
+ FlowSignUpStartResultV2,
50
+ FlowResetPasswordStartResultV2,
51
+ FlowRequestChallengeResultV2,
52
+ FlowSubmitNewPasswordResultV2,
53
+ FlowSubmitSignInPasswordResultV2,
54
+ FlowSignUpSubmitAttributesResultV2,
55
+ FlowSignUpVerificationResultV2,
54
56
  FlowSubmitCodeResultV2,
55
57
  FlowAuthMethodRegistrationRequiredResultV2,
56
58
  FlowAuthMethodVerificationRequiredResultV2,
@@ -100,16 +102,14 @@ import type { AuthenticationMethodV2 } from "../../auth_flow/v2/AuthenticationMe
100
102
  import type { AuthenticationMethodRegistrationV2 } from "../../auth_flow/v2/AuthenticationMethodRegistrationV2.js";
101
103
  import {
102
104
  SignUpSubmitAttributesNextActionV2,
105
+ type SignUpAttributeV2,
103
106
  type SignUpSubmitAttributesApiResultV2,
104
107
  } from "../../network_client/custom_auth_api/v2/result/SignUpResultsV2.js";
105
108
  import type { AuthMethodRegistrationRequestV2 } from "../../network_client/custom_auth_api/v2/request/RequestsV2.js";
106
109
  import { InvalidArgumentError } from "../../error/InvalidArgumentError.js";
107
110
  import type { ResetPasswordPollResultV2 } from "../../network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.js";
111
+ import * as ArgumentValidator from "../../utils/ArgumentValidator.js";
108
112
 
109
- /*
110
- * Polls up to five times for password-update completion, waiting 1.5 seconds
111
- * between attempts. The first request runs immediately.
112
- */
113
113
  const POLL_MAX_ATTEMPTS = 5;
114
114
  // TODO: Replace this fallback with the server-provided polling interval once available.
115
115
  const POLL_INTERVAL_MS = 1500;
@@ -118,8 +118,7 @@ const delay = (ms: number): Promise<void> =>
118
118
  new Promise((resolve) => setTimeout(resolve, ms));
119
119
 
120
120
  /*
121
- * Drives server-directed Native Auth V2 flows using opaque continuation state
122
- * and HAL links. Each operation returns only its valid discriminated results.
121
+ * Drives server-directed Native Auth V2 flows.
123
122
  */
124
123
  export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
125
124
  constructor(
@@ -146,19 +145,11 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
146
145
  }
147
146
 
148
147
  /*
149
- * Starts sign-in by automatically using a sole supported method or returning
150
- * multiple supported methods for user selection.
148
+ * Starts native auth V2 sign-in.
151
149
  */
152
150
  async signIn(
153
151
  parameters: FlowSignInStartParamsV2
154
- ): Promise<
155
- | FlowMethodSelectionRequiredResultV2
156
- | FlowPasswordRequiredResultV2
157
- | FlowSignInCodeRequiredResultV2
158
- | FlowMFARequiredResultV2
159
- | FlowAuthMethodRegistrationRequiredResultV2
160
- | FlowCompletedResultV2
161
- > {
152
+ ): Promise<FlowSignInStartResultV2> {
162
153
  const correlationId = parameters.correlationId;
163
154
  const context = this.createRequestContext(
164
155
  PublicApiId.SIGN_IN_V2_START,
@@ -237,28 +228,22 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
237
228
  };
238
229
  }
239
230
 
240
- if (parameters.password) {
241
- return this.submitSignInPassword({
242
- correlationId,
243
- continuationState: challengeResult.continuationState,
244
- password: parameters.password,
245
- });
246
- }
247
-
248
231
  return challengeResult;
249
232
  }
250
233
 
251
234
  /*
252
- * Starts sign-up and resolves the server-provided attribute-submission transition.
235
+ * Starts native auth V2 sign-up.
253
236
  */
254
237
  async signUp(
255
238
  parameters: FlowSignUpStartParamsV2
256
- ): Promise<
257
- | FlowCodeRequiredResultV2
258
- | FlowSignUpPasswordRequiredResultV2
259
- | FlowAttributesRequiredResultV2
260
- > {
239
+ ): Promise<FlowSignUpStartResultV2> {
261
240
  const correlationId = parameters.correlationId;
241
+ const pendingProfileAttributes =
242
+ ArgumentValidator.filterReservedSignUpAttributesV2(
243
+ parameters.attributes,
244
+ this.logger,
245
+ correlationId
246
+ );
262
247
  const context = this.createRequestContext(
263
248
  PublicApiId.SIGN_UP_V2_START,
264
249
  correlationId
@@ -280,70 +265,117 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
280
265
  }),
281
266
  {
282
267
  continuationToken: entryResult.continuationToken,
268
+ username: parameters.username,
283
269
  },
284
270
  context
285
271
  );
286
- const attributes = Object.fromEntries(
287
- Object.entries(parameters.attributes ?? {}).filter(
288
- ([name]) =>
289
- name.toLowerCase() !== "email" &&
290
- name.toLowerCase() !== "password"
291
- )
292
- );
293
- attributes.email = parameters.username;
294
- if (parameters.password !== undefined) {
295
- attributes.password = parameters.password;
272
+ if (startResult.nextAction === VERIFY_RELATION) {
273
+ if (
274
+ startResult.type?.toLowerCase() !==
275
+ AuthenticationMethodTypeV2.EMAIL
276
+ ) {
277
+ const message =
278
+ "New-account sign-up requires an email code challenge.";
279
+ this.logger.error(message, correlationId);
280
+ throw new CustomAuthError(
281
+ UNSUPPORTED_FLOW_TRANSITION,
282
+ message,
283
+ correlationId
284
+ );
285
+ }
286
+
287
+ return createFlowCodeRequiredResultV2({
288
+ correlationId,
289
+ continuationState: {
290
+ continuationToken: startResult.continuationToken,
291
+ scenario: CustomAuthFlowScenarioV2.SignUp,
292
+ scopes,
293
+ links: {
294
+ verify: startResult.verifyHref,
295
+ resend: startResult.resendHref,
296
+ },
297
+ signUp: {
298
+ purpose: "newAccount",
299
+ pendingProfileAttributes,
300
+ submittedAttributeIds: [],
301
+ },
302
+ },
303
+ channel: startResult.type,
304
+ sentTo: startResult.hint,
305
+ codeLength: startResult.codeLength,
306
+ });
296
307
  }
297
- const submitResult = await this.apiClient.submitSignUpAttributes(
298
- startResult.submitAttributesHref,
299
- {
300
- continuationToken: startResult.continuationToken,
301
- attributes,
302
- },
303
- context
304
- );
308
+
305
309
  const continuationState: FlowContinuationStateV2 = {
306
310
  continuationToken: startResult.continuationToken,
307
311
  scenario: CustomAuthFlowScenarioV2.SignUp,
308
312
  scopes,
309
313
  links: {},
310
314
  signUp: {
311
- passwordWasSupplied: attributes.password !== undefined,
315
+ purpose: "existingAccount",
312
316
  },
313
317
  };
314
-
315
- const result = this.toSignUpActionResult(
316
- submitResult,
317
- continuationState,
318
+ this.ensureAuthenticationFactor(
319
+ startResult.authenticationFactor,
320
+ AuthenticationFactorV2.SINGLE_FACTOR,
321
+ "existing-account sign-up",
318
322
  correlationId
319
323
  );
324
+ const supportedMethods = startResult.methods
325
+ .map((method) => ({
326
+ id: method.id,
327
+ type: method.type ?? "",
328
+ hint: method.hint,
329
+ challengeHref: method.challengeHref,
330
+ }))
331
+ .filter((method) => {
332
+ const methodType = method.type.toLowerCase();
333
+ return (
334
+ methodType === AuthenticationMethodTypeV2.EMAIL ||
335
+ methodType === AuthenticationMethodTypeV2.PASSWORD
336
+ );
337
+ });
320
338
 
321
- if (
322
- result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 ||
323
- result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2
324
- ) {
325
- const message = `Initial sign-up attribute submission returned unsupported next action '${submitResult.nextAction}'.`;
326
- this.logger.error(message, correlationId);
339
+ if (supportedMethods.length === 0) {
327
340
  throw new CustomAuthError(
328
341
  UNSUPPORTED_FLOW_TRANSITION,
329
- message,
342
+ "The existing-account sign-up response must include an email or password method.",
330
343
  correlationId
331
344
  );
332
345
  }
333
346
 
334
- return result;
347
+ if (supportedMethods.length > 1) {
348
+ return createFlowMethodSelectionRequiredResultV2({
349
+ correlationId,
350
+ continuationState,
351
+ methods: supportedMethods,
352
+ });
353
+ }
354
+
355
+ const selectedMethod = supportedMethods[0];
356
+ const challengeResult = await this.requestChallenge({
357
+ correlationId,
358
+ continuationState: {
359
+ ...continuationState,
360
+ links: {
361
+ challenge: selectedMethod.challengeHref,
362
+ },
363
+ },
364
+ });
365
+
366
+ return this.toExistingAccountChallengeResult(
367
+ challengeResult,
368
+ selectedMethod,
369
+ correlationId
370
+ );
335
371
  }
336
372
 
337
373
  /*
338
- * Starts password reset, automatically challenging a sole method or
339
- * returning multiple methods for selection.
374
+ * Starts native auth V2 password reset.
340
375
  */
341
376
  async resetPassword(
342
377
  parameters: FlowStartParamsV2
343
- ): Promise<
344
- | FlowMethodSelectionRequiredResultV2
345
- | FlowResetPasswordCodeRequiredResultV2
346
- > {
378
+ ): Promise<FlowResetPasswordStartResultV2> {
347
379
  const correlationId = parameters.correlationId;
348
380
  const context = this.createRequestContext(
349
381
  PublicApiId.RESET_PASSWORD_V2_START,
@@ -403,63 +435,62 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
403
435
  );
404
436
  }
405
437
 
406
- if (methods.length === 1) {
407
- const selectedMethod = methods[0];
408
- const challengeResult = await this.requestChallenge({
438
+ if (methods.length > 1) {
439
+ this.logger.verbose(
440
+ "V2 self-service password reset method selection required.",
441
+ correlationId
442
+ );
443
+
444
+ return createFlowMethodSelectionRequiredResultV2({
409
445
  correlationId,
410
- continuationState: {
411
- ...continuationState,
412
- links: {
413
- challenge: selectedMethod.challengeHref,
414
- },
415
- },
446
+ continuationState,
447
+ methods,
416
448
  });
449
+ }
417
450
 
418
- if (
419
- challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
420
- (challengeResult.channel?.toLowerCase() ===
421
- AuthenticationMethodTypeV2.EMAIL ||
422
- challengeResult.channel?.toLowerCase() ===
423
- AuthenticationMethodTypeV2.SMS)
424
- ) {
425
- return {
426
- ...challengeResult,
427
- method: selectedMethod,
428
- };
429
- }
451
+ const selectedMethod = methods[0];
452
+ const challengeResult = await this.requestChallenge({
453
+ correlationId,
454
+ continuationState: {
455
+ ...continuationState,
456
+ links: {
457
+ challenge: selectedMethod.challengeHref,
458
+ },
459
+ },
460
+ });
430
461
 
431
- const channel =
432
- challengeResult.type === FLOW_CODE_REQUIRED_V2
433
- ? challengeResult.channel
434
- : AuthenticationMethodTypeV2.PASSWORD;
435
- const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
436
- this.logger.error(message, correlationId);
437
- throw new CustomAuthError(
438
- UNSUPPORTED_FLOW_TRANSITION,
439
- message,
440
- correlationId
441
- );
462
+ if (
463
+ challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
464
+ (challengeResult.channel?.toLowerCase() ===
465
+ AuthenticationMethodTypeV2.EMAIL ||
466
+ challengeResult.channel?.toLowerCase() ===
467
+ AuthenticationMethodTypeV2.SMS)
468
+ ) {
469
+ return {
470
+ ...challengeResult,
471
+ method: selectedMethod,
472
+ };
442
473
  }
443
474
 
444
- this.logger.verbose(
445
- "V2 self-service password reset method selection required.",
475
+ const channel =
476
+ challengeResult.type === FLOW_CODE_REQUIRED_V2
477
+ ? challengeResult.channel
478
+ : AuthenticationMethodTypeV2.PASSWORD;
479
+ const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
480
+ this.logger.error(message, correlationId);
481
+ throw new CustomAuthError(
482
+ UNSUPPORTED_FLOW_TRANSITION,
483
+ message,
446
484
  correlationId
447
485
  );
448
-
449
- return createFlowMethodSelectionRequiredResultV2({
450
- correlationId,
451
- continuationState,
452
- methods,
453
- });
454
486
  }
455
487
 
456
488
  /*
457
- * Requests a one-time code for the selected authentication method. Returns
458
- * the continuation state and code metadata needed for verification.
489
+ * Requests a challenge for the selected authentication method.
459
490
  */
460
491
  async requestChallenge(
461
492
  parameters: FlowChallengeParamsV2
462
- ): Promise<FlowCodeRequiredResultV2 | FlowPasswordRequiredResultV2> {
493
+ ): Promise<FlowRequestChallengeResultV2> {
463
494
  const challengeResult = await this.sendMethodChallenge(
464
495
  parameters,
465
496
  "requestChallenge"
@@ -503,7 +534,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
503
534
  }
504
535
 
505
536
  /*
506
- * Registers the selected offered method and returns activation metadata.
537
+ * Registers the selected authentication method.
507
538
  */
508
539
  async registerAuthMethod(
509
540
  parameters: FlowRegisterAuthMethodParamsV2
@@ -545,12 +576,11 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
545
576
  }
546
577
 
547
578
  /*
548
- * Activates the registered method and redeems the resulting continuation
549
- * for tokens.
579
+ * Activates the registered authentication method.
550
580
  */
551
581
  async verifyAuthMethodRegistration(
552
582
  parameters: FlowVerifyAuthMethodRegistrationParamsV2
553
- ): Promise<FlowCompletedResultV2> {
583
+ ): Promise<FlowCompletedResultV2 | FlowSignInContinuationRequiredResultV2> {
554
584
  const { continuationState, correlationId } = parameters;
555
585
 
556
586
  const context = this.createRequestContext(
@@ -570,6 +600,21 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
570
600
  context
571
601
  );
572
602
 
603
+ if (
604
+ continuationState.scenario === CustomAuthFlowScenarioV2.SignUp ||
605
+ continuationState.scenario ===
606
+ CustomAuthFlowScenarioV2.PasswordReset
607
+ ) {
608
+ return createFlowSignInContinuationRequiredResultV2({
609
+ correlationId,
610
+ continuationState: {
611
+ ...continuationState,
612
+ continuationToken: result.continuationToken,
613
+ links: {},
614
+ },
615
+ });
616
+ }
617
+
573
618
  return this.completeSignInAfterVerification(
574
619
  continuationState,
575
620
  result.continuationToken,
@@ -578,8 +623,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
578
623
  }
579
624
 
580
625
  /*
581
- * Requests a replacement activation challenge through the server-provided
582
- * resend link using the latest continuation token.
626
+ * Requests a replacement authentication-method activation challenge.
583
627
  */
584
628
  async resendAuthMethodRegistrationChallenge(
585
629
  parameters: FlowChallengeParamsV2
@@ -610,8 +654,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
610
654
  }
611
655
 
612
656
  /*
613
- * Verifies the submitted one-time code using the server-provided link. The
614
- * response determines the next required action.
657
+ * Verifies the submitted one-time code.
615
658
  */
616
659
  async submitCode(
617
660
  parameters: FlowSubmitCodeParamsV2
@@ -647,6 +690,25 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
647
690
  if (
648
691
  continuationState.scenario ===
649
692
  CustomAuthFlowScenarioV2.PasswordReset &&
693
+ parameters.authenticationFactor ===
694
+ AuthenticationFactorV2.MULTI_FACTOR &&
695
+ verifyResult.nextAction === ResponseStateV2.CONTINUE
696
+ ) {
697
+ return createFlowSignInContinuationRequiredResultV2({
698
+ correlationId,
699
+ continuationState: {
700
+ ...continuationState,
701
+ continuationToken: verifyResult.continuationToken,
702
+ links: {},
703
+ },
704
+ });
705
+ }
706
+
707
+ if (
708
+ continuationState.scenario ===
709
+ CustomAuthFlowScenarioV2.PasswordReset &&
710
+ parameters.authenticationFactor !==
711
+ AuthenticationFactorV2.MULTI_FACTOR &&
650
712
  verifyResult.nextAction === UPDATE_RELATION
651
713
  ) {
652
714
  return createFlowNewPasswordRequiredResultV2({
@@ -668,6 +730,17 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
668
730
  );
669
731
  }
670
732
 
733
+ if (
734
+ continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
735
+ continuationState.signUp?.purpose === "existingAccount"
736
+ ) {
737
+ return this.handleSignInVerification(
738
+ continuationState,
739
+ verifyResult,
740
+ correlationId
741
+ );
742
+ }
743
+
671
744
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
672
745
  return this.handleSignUpVerification(
673
746
  continuationState,
@@ -687,8 +760,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
687
760
  }
688
761
 
689
762
  /*
690
- * Requests a new one-time code using the server-provided resend link.
691
- * Returns refreshed continuation state and code metadata.
763
+ * Requests a replacement one-time code.
692
764
  */
693
765
  async resendCode(
694
766
  parameters: FlowChallengeParamsV2
@@ -697,6 +769,20 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
697
769
  parameters,
698
770
  "resendCode"
699
771
  );
772
+ const challengeType = challengeResult.type?.toLowerCase();
773
+ if (
774
+ challengeType !== AuthenticationMethodTypeV2.EMAIL &&
775
+ challengeType !== AuthenticationMethodTypeV2.SMS
776
+ ) {
777
+ const message =
778
+ "A replacement code requires an email or SMS code challenge.";
779
+ this.logger.error(message, parameters.correlationId);
780
+ throw new CustomAuthError(
781
+ UNSUPPORTED_FLOW_TRANSITION,
782
+ message,
783
+ parameters.correlationId
784
+ );
785
+ }
700
786
 
701
787
  return createFlowCodeRequiredResultV2({
702
788
  correlationId: parameters.correlationId,
@@ -712,8 +798,12 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
712
798
 
713
799
  async submitSignUpAttributes(
714
800
  parameters: FlowSubmitSignUpAttributesParamsV2
715
- ): Promise<FlowSignUpActionResultV2> {
716
- const { continuationState, correlationId, attributes } = parameters;
801
+ ): Promise<FlowSignUpSubmitAttributesResultV2> {
802
+ const {
803
+ continuationState,
804
+ correlationId,
805
+ attributes: submittedAttributes,
806
+ } = parameters;
717
807
  const context = this.createRequestContext(
718
808
  this.resolveStepApiId(
719
809
  continuationState.scenario,
@@ -728,6 +818,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
728
818
  correlationId
729
819
  );
730
820
 
821
+ const submittedAttributeIds = Object.keys(submittedAttributes);
731
822
  const submitResult = await this.apiClient.submitSignUpAttributes(
732
823
  this.requireLink(
733
824
  correlationId,
@@ -735,19 +826,24 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
735
826
  ),
736
827
  {
737
828
  continuationToken: continuationState.continuationToken,
738
- attributes,
829
+ attributes: submittedAttributes,
739
830
  },
740
831
  context
741
832
  );
742
833
 
743
- return this.toSignUpActionResult(
834
+ return this.toSignUpSubmitAttributesResult(
744
835
  submitResult,
745
836
  {
746
837
  ...continuationState,
747
838
  signUp: {
748
- passwordWasSupplied:
749
- continuationState.signUp?.passwordWasSupplied ===
750
- true || attributes.password !== undefined,
839
+ purpose: "newAccount",
840
+ submittedAttributeIds: [
841
+ ...new Set([
842
+ ...(continuationState.signUp
843
+ ?.submittedAttributeIds ?? []),
844
+ ...submittedAttributeIds,
845
+ ]),
846
+ ],
751
847
  },
752
848
  },
753
849
  correlationId
@@ -755,15 +851,12 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
755
851
  }
756
852
 
757
853
  /*
758
- * Submits the new password and polls until the reset completes. The result
759
- * contains the continuation state required for explicit sign-in.
854
+ * Submits the new password and polls for the next action: method registration,
855
+ * MFA, or a continuation for explicit sign-in.
760
856
  */
761
857
  async submitNewPassword(
762
858
  parameters: FlowSubmitNewPasswordParamsV2
763
- ): Promise<
764
- | FlowSignInContinuationRequiredResultV2
765
- | FlowAuthMethodRegistrationRequiredResultV2
766
- > {
859
+ ): Promise<FlowSubmitNewPasswordResultV2> {
767
860
  const continuationState = parameters.continuationState;
768
861
  const correlationId = parameters.correlationId;
769
862
  const context = this.createRequestContext(
@@ -799,7 +892,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
799
892
  );
800
893
 
801
894
  isPolling = pollResult.nextAction === POLL_RELATION;
802
- if (!isPolling) {
895
+ if (pollResult.nextAction !== POLL_RELATION) {
803
896
  break;
804
897
  }
805
898
 
@@ -823,10 +916,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
823
916
  );
824
917
  }
825
918
 
826
- if (
827
- pollResult.nextAction === ENROLL_RELATION &&
828
- pollResult.enrollmentMethods
829
- ) {
919
+ if (pollResult.nextAction === ENROLL_RELATION && pollResult.methods) {
830
920
  return this.createAuthMethodRegistrationRequiredResult({
831
921
  correlationId,
832
922
  continuationState: {
@@ -834,7 +924,43 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
834
924
  continuationToken: pollResult.continuationToken,
835
925
  links: {},
836
926
  },
837
- methods: pollResult.enrollmentMethods,
927
+ methods: pollResult.methods,
928
+ });
929
+ }
930
+
931
+ if (pollResult.nextAction === CHALLENGE_RELATION) {
932
+ if (!pollResult.authenticationFactor) {
933
+ const message =
934
+ "Password-reset MFA challenge is missing its authentication factor.";
935
+ this.logger.error(message, correlationId);
936
+ throw new CustomAuthError(
937
+ UNSUPPORTED_FLOW_TRANSITION,
938
+ message,
939
+ correlationId
940
+ );
941
+ }
942
+
943
+ this.ensureAuthenticationFactor(
944
+ pollResult.authenticationFactor,
945
+ AuthenticationFactorV2.MULTI_FACTOR,
946
+ "after password reset",
947
+ correlationId
948
+ );
949
+
950
+ return createFlowMFARequiredResultV2({
951
+ correlationId,
952
+ continuationState: {
953
+ continuationToken: pollResult.continuationToken,
954
+ scenario: continuationState.scenario,
955
+ scopes: continuationState.scopes,
956
+ links: {},
957
+ },
958
+ methods: pollResult.methods.map((method) => ({
959
+ id: method.id,
960
+ type: method.type ?? "",
961
+ hint: method.hint,
962
+ challengeHref: method.challengeHref,
963
+ })),
838
964
  });
839
965
  }
840
966
 
@@ -865,15 +991,11 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
865
991
  }
866
992
 
867
993
  /*
868
- * Verifies a sign-in password and returns the next sign-in action.
994
+ * Verifies the sign-in password.
869
995
  */
870
996
  async submitSignInPassword(
871
997
  parameters: FlowSubmitSignInPasswordParamsV2
872
- ): Promise<
873
- | FlowMFARequiredResultV2
874
- | FlowAuthMethodRegistrationRequiredResultV2
875
- | FlowCompletedResultV2
876
- > {
998
+ ): Promise<FlowSubmitSignInPasswordResultV2> {
877
999
  const verifyResult = await this.verifySignInPassword(parameters);
878
1000
 
879
1001
  return this.handleSignInVerification(
@@ -884,8 +1006,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
884
1006
  }
885
1007
 
886
1008
  /*
887
- * Redeems the completed flow continuation for tokens. Returns the
888
- * authentication result after validating and caching the response.
1009
+ * Signs the user in from a completed flow.
889
1010
  */
890
1011
  async signInWithContinuation(
891
1012
  parameters: FlowSignInWithContinuationParamsV2
@@ -933,11 +1054,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
933
1054
  continuationState: FlowContinuationStateV2,
934
1055
  verifyResult: VerifyResultV2,
935
1056
  correlationId: string
936
- ): Promise<
937
- | FlowMFARequiredResultV2
938
- | FlowAuthMethodRegistrationRequiredResultV2
939
- | FlowCompletedResultV2
940
- > {
1057
+ ): Promise<FlowSubmitSignInPasswordResultV2> {
941
1058
  if (verifyResult.nextAction === ENROLL_RELATION) {
942
1059
  return this.createAuthMethodRegistrationRequiredResult({
943
1060
  correlationId,
@@ -954,16 +1071,15 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
954
1071
  this.ensureAuthenticationFactor(
955
1072
  verifyResult.authenticationFactor,
956
1073
  AuthenticationFactorV2.MULTI_FACTOR,
957
- "after sign-in verification",
1074
+ "after authentication verification",
958
1075
  correlationId
959
1076
  );
960
1077
 
961
1078
  return createFlowMFARequiredResultV2({
962
1079
  correlationId,
963
1080
  continuationState: {
1081
+ ...continuationState,
964
1082
  continuationToken: verifyResult.continuationToken,
965
- scenario: continuationState.scenario,
966
- scopes: continuationState.scopes,
967
1083
  links: {},
968
1084
  },
969
1085
  methods: verifyResult.methods.map((method) => ({
@@ -983,7 +1099,7 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
983
1099
  );
984
1100
  }
985
1101
 
986
- const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
1102
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for authentication.`;
987
1103
  this.logger.error(message, correlationId);
988
1104
  throw new CustomAuthError(
989
1105
  UNSUPPORTED_FLOW_TRANSITION,
@@ -992,51 +1108,50 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
992
1108
  );
993
1109
  }
994
1110
 
995
- private handleSignUpVerification(
1111
+ private async handleSignUpVerification(
996
1112
  continuationState: FlowContinuationStateV2,
997
1113
  verifyResult: VerifyResultV2,
998
1114
  correlationId: string
999
- ):
1000
- | FlowAuthMethodRegistrationRequiredResultV2
1001
- | FlowSignUpPasswordRequiredResultV2
1002
- | FlowAttributesRequiredResultV2
1003
- | FlowSignInContinuationRequiredResultV2 {
1115
+ ): Promise<FlowSignUpVerificationResultV2> {
1004
1116
  if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
1005
- const requiredPasswordAttribute = verifyResult.attributes.find(
1117
+ const requestedAttributes = verifyResult.attributes;
1118
+ const requestedPasswordAttribute = requestedAttributes.find(
1006
1119
  (attribute) =>
1007
- attribute.attributeId.toLowerCase() === "password" &&
1008
- attribute.required === true
1120
+ attribute.attributeId.toLowerCase() === "password"
1009
1121
  );
1010
1122
  const nextContinuationState: FlowContinuationStateV2 = {
1123
+ ...continuationState,
1011
1124
  continuationToken: verifyResult.continuationToken,
1012
- scenario: continuationState.scenario,
1013
- scopes: continuationState.scopes,
1014
1125
  links: {
1015
1126
  submitAttributes: verifyResult.submitAttributesHref,
1016
1127
  },
1017
- signUp: continuationState.signUp,
1018
1128
  };
1019
- const attributes = verifyResult.attributes.filter(
1020
- (attribute) =>
1021
- attribute.attributeId.toLowerCase() !== "password"
1022
- );
1129
+ const pendingProfileAttributes =
1130
+ continuationState.signUp?.pendingProfileAttributes;
1023
1131
 
1024
1132
  if (
1025
- requiredPasswordAttribute &&
1026
- continuationState.signUp?.passwordWasSupplied !== true
1133
+ pendingProfileAttributes &&
1134
+ Object.keys(pendingProfileAttributes).length > 0
1027
1135
  ) {
1136
+ return this.submitSignUpAttributes({
1137
+ correlationId,
1138
+ continuationState: nextContinuationState,
1139
+ attributes: pendingProfileAttributes,
1140
+ });
1141
+ }
1142
+
1143
+ if (requestedPasswordAttribute) {
1028
1144
  return createFlowSignUpPasswordRequiredResultV2({
1029
1145
  correlationId,
1030
1146
  continuationState: nextContinuationState,
1031
- attributes,
1032
- requiredPasswordAttribute,
1147
+ requestedPasswordAttribute,
1033
1148
  });
1034
1149
  }
1035
1150
 
1036
1151
  return createFlowAttributesRequiredResultV2({
1037
1152
  correlationId,
1038
1153
  continuationState: nextContinuationState,
1039
- attributes,
1154
+ attributes: requestedAttributes,
1040
1155
  });
1041
1156
  }
1042
1157
 
@@ -1056,9 +1171,8 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1056
1171
  return createFlowSignInContinuationRequiredResultV2({
1057
1172
  correlationId,
1058
1173
  continuationState: {
1174
+ ...continuationState,
1059
1175
  continuationToken: verifyResult.continuationToken,
1060
- scenario: continuationState.scenario,
1061
- scopes: continuationState.scopes,
1062
1176
  links: {},
1063
1177
  },
1064
1178
  });
@@ -1226,32 +1340,13 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1226
1340
  });
1227
1341
  }
1228
1342
 
1229
- private toSignUpActionResult(
1343
+ private toSignUpSubmitAttributesResult(
1230
1344
  result: SignUpSubmitAttributesApiResultV2,
1231
1345
  continuationState: FlowContinuationStateV2,
1232
1346
  correlationId: string
1233
- ): FlowSignUpActionResultV2 {
1347
+ ): FlowSignUpSubmitAttributesResultV2 {
1234
1348
  const nextAction: string = result.nextAction;
1235
1349
 
1236
- if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
1237
- return createFlowCodeRequiredResultV2({
1238
- correlationId,
1239
- continuationState: {
1240
- continuationToken: result.continuationToken,
1241
- scenario: continuationState.scenario,
1242
- scopes: continuationState.scopes,
1243
- links: {
1244
- verify: result.verifyHref,
1245
- resend: result.resendHref,
1246
- },
1247
- signUp: continuationState.signUp,
1248
- },
1249
- channel: result.type,
1250
- sentTo: result.hint,
1251
- codeLength: result.codeLength,
1252
- });
1253
- }
1254
-
1255
1350
  if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
1256
1351
  return this.createAuthMethodRegistrationRequiredResult({
1257
1352
  correlationId,
@@ -1268,41 +1363,36 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1268
1363
  result.nextAction ===
1269
1364
  SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES
1270
1365
  ) {
1271
- const requiredPasswordAttribute = result.attributes.find(
1272
- (attribute) =>
1273
- attribute.attributeId.toLowerCase() === "password" &&
1274
- attribute.required === true
1366
+ const requestedAttributes = result.attributes;
1367
+ this.ensureValidSignUpAttributeCollectionAfterSubmission(
1368
+ requestedAttributes,
1369
+ continuationState,
1370
+ correlationId
1275
1371
  );
1276
1372
  const nextContinuationState: FlowContinuationStateV2 = {
1373
+ ...continuationState,
1277
1374
  continuationToken: result.continuationToken,
1278
- scenario: continuationState.scenario,
1279
- scopes: continuationState.scopes,
1280
1375
  links: {
1281
1376
  submitAttributes: result.submitAttributesHref,
1282
1377
  },
1283
- signUp: continuationState.signUp,
1284
1378
  };
1285
- const attributes = result.attributes.filter(
1379
+
1380
+ const requestedPasswordAttribute = requestedAttributes.find(
1286
1381
  (attribute) =>
1287
- attribute.attributeId.toLowerCase() !== "password"
1382
+ attribute.attributeId.toLowerCase() === "password"
1288
1383
  );
1289
-
1290
- if (
1291
- requiredPasswordAttribute &&
1292
- continuationState.signUp?.passwordWasSupplied !== true
1293
- ) {
1384
+ if (requestedPasswordAttribute) {
1294
1385
  return createFlowSignUpPasswordRequiredResultV2({
1295
1386
  correlationId,
1296
1387
  continuationState: nextContinuationState,
1297
- attributes,
1298
- requiredPasswordAttribute,
1388
+ requestedPasswordAttribute,
1299
1389
  });
1300
1390
  }
1301
1391
 
1302
1392
  return createFlowAttributesRequiredResultV2({
1303
1393
  correlationId,
1304
1394
  continuationState: nextContinuationState,
1305
- attributes,
1395
+ attributes: requestedAttributes,
1306
1396
  });
1307
1397
  }
1308
1398
 
@@ -1310,9 +1400,8 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1310
1400
  return createFlowSignInContinuationRequiredResultV2({
1311
1401
  correlationId,
1312
1402
  continuationState: {
1403
+ ...continuationState,
1313
1404
  continuationToken: result.continuationToken,
1314
- scenario: continuationState.scenario,
1315
- scopes: continuationState.scopes,
1316
1405
  links: {},
1317
1406
  },
1318
1407
  });
@@ -1327,6 +1416,38 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1327
1416
  );
1328
1417
  }
1329
1418
 
1419
+ private ensureValidSignUpAttributeCollectionAfterSubmission(
1420
+ requestedAttributes: SignUpAttributeV2[],
1421
+ continuationState: FlowContinuationStateV2,
1422
+ correlationId: string
1423
+ ): void {
1424
+ const submittedAttributeIds =
1425
+ continuationState.signUp?.submittedAttributeIds ?? [];
1426
+ const hasSubmittedPassword = submittedAttributeIds.some(
1427
+ (attributeId) => attributeId.toLowerCase() === "password"
1428
+ );
1429
+ const invalidAttribute = requestedAttributes.find(
1430
+ (requestedAttribute) =>
1431
+ requestedAttribute.attributeId.toLowerCase() === "password"
1432
+ ? hasSubmittedPassword
1433
+ : submittedAttributeIds.includes(
1434
+ requestedAttribute.attributeId
1435
+ )
1436
+ );
1437
+ if (invalidAttribute) {
1438
+ const message =
1439
+ invalidAttribute.attributeId.toLowerCase() === "password"
1440
+ ? "The sign-up API cannot request password collection after attribute submission."
1441
+ : "The sign-up API requested an attribute that was already successfully submitted.";
1442
+ this.logger.error(message, correlationId);
1443
+ throw new CustomAuthError(
1444
+ UNSUPPORTED_FLOW_TRANSITION,
1445
+ message,
1446
+ correlationId
1447
+ );
1448
+ }
1449
+ }
1450
+
1330
1451
  private ensureAuthenticationFactor(
1331
1452
  authenticationFactor: AuthenticationFactorV2,
1332
1453
  expectedFactor: AuthenticationFactorV2,
@@ -1346,6 +1467,43 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1346
1467
  );
1347
1468
  }
1348
1469
 
1470
+ private toExistingAccountChallengeResult(
1471
+ challengeResult: FlowRequestChallengeResultV2,
1472
+ method: AuthenticationMethodV2,
1473
+ correlationId: string
1474
+ ): FlowExistingAccountChallengeResultV2 {
1475
+ if (
1476
+ challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
1477
+ challengeResult.channel?.toLowerCase() ===
1478
+ AuthenticationMethodTypeV2.EMAIL
1479
+ ) {
1480
+ return createFlowExistingAccountCodeRequiredResultV2({
1481
+ correlationId,
1482
+ continuationState: challengeResult.continuationState,
1483
+ method,
1484
+ channel: challengeResult.channel,
1485
+ sentTo: challengeResult.sentTo,
1486
+ codeLength: challengeResult.codeLength,
1487
+ });
1488
+ }
1489
+
1490
+ if (challengeResult.type === FLOW_PASSWORD_REQUIRED_V2) {
1491
+ return createFlowExistingAccountPasswordRequiredResultV2({
1492
+ correlationId,
1493
+ continuationState: challengeResult.continuationState,
1494
+ });
1495
+ }
1496
+
1497
+ const message =
1498
+ "Existing-account sign-up requires an email code challenge or a password challenge.";
1499
+ this.logger.error(message, correlationId);
1500
+ throw new CustomAuthError(
1501
+ UNSUPPORTED_FLOW_TRANSITION,
1502
+ message,
1503
+ correlationId
1504
+ );
1505
+ }
1506
+
1349
1507
  private async verifySignInPassword(
1350
1508
  parameters: FlowSubmitSignInPasswordParamsV2
1351
1509
  ): Promise<VerifyResultV2> {
@@ -1359,7 +1517,10 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1359
1517
  correlationId
1360
1518
  );
1361
1519
 
1362
- this.logger.verbose("Submitting V2 sign-in password.", correlationId);
1520
+ this.logger.verbose(
1521
+ "Submitting V2 authentication password.",
1522
+ correlationId
1523
+ );
1363
1524
 
1364
1525
  return this.apiClient.verifyChallenge(
1365
1526
  this.requireLink(correlationId, continuationState.links.verify),
@@ -1379,9 +1540,8 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1379
1540
  return this.signInWithContinuation({
1380
1541
  correlationId,
1381
1542
  continuationState: {
1543
+ ...continuationState,
1382
1544
  continuationToken,
1383
- scenario: continuationState.scenario,
1384
- scopes: continuationState.scopes,
1385
1545
  links: {},
1386
1546
  },
1387
1547
  });
@@ -1447,9 +1607,8 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1447
1607
  challengeResult: ChallengeVerificationResultV2
1448
1608
  ): FlowContinuationStateV2 {
1449
1609
  return {
1610
+ ...continuationState,
1450
1611
  continuationToken: challengeResult.continuationToken,
1451
- scenario: continuationState.scenario,
1452
- scopes: continuationState.scopes,
1453
1612
  links: {
1454
1613
  challenge: continuationState.links.challenge,
1455
1614
  verify: challengeResult.verifyHref,
@@ -1457,9 +1616,6 @@ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
1457
1616
  challengeResult.resendHref ??
1458
1617
  continuationState.links.resend,
1459
1618
  },
1460
- ...(continuationState.signUp && {
1461
- signUp: continuationState.signUp,
1462
- }),
1463
1619
  };
1464
1620
  }
1465
1621