@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,4 +1,4 @@
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
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msalCustomAuth = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v16.16.0 2026-11-05 */
9
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -66,7 +66,7 @@
66
66
  */
67
67
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
68
68
 
69
- /*! @azure/msal-common v16.16.0 2026-11-05 */
69
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
70
70
  /*
71
71
  * Copyright (c) Microsoft Corporation. All rights reserved.
72
72
  * Licensed under the MIT License.
@@ -300,7 +300,7 @@
300
300
  // Token renewal offset default in seconds
301
301
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
302
302
 
303
- /*! @azure/msal-common v16.16.0 2026-11-05 */
303
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
304
304
  /*
305
305
  * Copyright (c) Microsoft Corporation. All rights reserved.
306
306
  * Licensed under the MIT License.
@@ -329,7 +329,7 @@
329
329
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
330
330
  }
331
331
 
332
- /*! @azure/msal-common v16.16.0 2026-11-05 */
332
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
333
333
 
334
334
  /*
335
335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -352,7 +352,7 @@
352
352
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
353
353
  }
354
354
 
355
- /*! @azure/msal-common v16.16.0 2026-11-05 */
355
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
356
356
  /*
357
357
  * Copyright (c) Microsoft Corporation. All rights reserved.
358
358
  * Licensed under the MIT License.
@@ -390,7 +390,7 @@
390
390
  const resourceParameterRequired = "resource_parameter_required";
391
391
  const misplacedResourceParam = "misplaced_resource_parameter";
392
392
 
393
- /*! @azure/msal-common v16.16.0 2026-11-05 */
393
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
394
394
 
395
395
  /*
396
396
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -428,7 +428,7 @@
428
428
  };
429
429
  }
430
430
 
431
- /*! @azure/msal-common v16.16.0 2026-11-05 */
431
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
432
432
 
433
433
  /*
434
434
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -494,7 +494,7 @@
494
494
  return matches[2];
495
495
  }
496
496
 
497
- /*! @azure/msal-common v16.16.0 2026-11-05 */
497
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
498
498
 
499
499
  /*
500
500
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -582,7 +582,7 @@
582
582
  return updatedAccountInfo;
583
583
  }
584
584
 
585
- /*! @azure/msal-common v16.16.0 2026-11-05 */
585
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
586
586
  /*
587
587
  * Copyright (c) Microsoft Corporation. All rights reserved.
588
588
  * Licensed under the MIT License.
@@ -596,7 +596,7 @@
596
596
  Ciam: 3,
597
597
  };
598
598
 
599
- /*! @azure/msal-common v16.16.0 2026-11-05 */
599
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
600
600
  /*
601
601
  * Copyright (c) Microsoft Corporation. All rights reserved.
602
602
  * Licensed under the MIT License.
@@ -618,7 +618,7 @@
618
618
  return null;
619
619
  }
620
620
 
621
- /*! @azure/msal-common v16.16.0 2026-11-05 */
621
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
622
622
  /*
623
623
  * Copyright (c) Microsoft Corporation. All rights reserved.
624
624
  * Licensed under the MIT License.
@@ -642,7 +642,7 @@
642
642
  EAR: "EAR",
643
643
  };
644
644
 
645
- /*! @azure/msal-common v16.16.0 2026-11-05 */
645
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
646
646
  /**
647
647
  * Returns the AccountInfo interface for this account.
648
648
  * @internal
@@ -831,7 +831,7 @@
831
831
  entity.hasOwnProperty("authorityType"));
832
832
  }
833
833
 
834
- /*! @azure/msal-common v16.16.0 2026-11-05 */
834
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
835
835
  /*
836
836
  * Copyright (c) Microsoft Corporation. All rights reserved.
837
837
  * Licensed under the MIT License.
@@ -841,7 +841,7 @@
841
841
  */
842
842
  const unexpectedError = "unexpected_error";
843
843
 
844
- /*! @azure/msal-common v16.16.0 2026-11-05 */
844
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
845
845
 
846
846
  /*
847
847
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -861,7 +861,7 @@
861
861
  return new ClientConfigurationError(errorCode, correlationId);
862
862
  }
863
863
 
864
- /*! @azure/msal-common v16.16.0 2026-11-05 */
864
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
865
865
  /*
866
866
  * Copyright (c) Microsoft Corporation. All rights reserved.
867
867
  * Licensed under the MIT License.
@@ -901,7 +901,7 @@
901
901
  return headerName === undefined ? undefined : headers[headerName];
902
902
  }
903
903
 
904
- /*! @azure/msal-common v16.16.0 2026-11-05 */
904
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
905
905
  /*
906
906
  * Copyright (c) Microsoft Corporation. All rights reserved.
907
907
  * Licensed under the MIT License.
@@ -932,7 +932,7 @@
932
932
  const invalidDpopNonce = "invalid_dpop_nonce";
933
933
  const dpopMissingResourceContext = "dpop_missing_resource_context";
934
934
 
935
- /*! @azure/msal-common v16.16.0 2026-11-05 */
935
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
936
936
  /*
937
937
  * Copyright (c) Microsoft Corporation. All rights reserved.
938
938
  * Licensed under the MIT License.
@@ -944,7 +944,7 @@
944
944
  response.hasOwnProperty("jwks_uri"));
945
945
  }
946
946
 
947
- /*! @azure/msal-common v16.16.0 2026-11-05 */
947
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
948
948
  /*
949
949
  * Copyright (c) Microsoft Corporation. All rights reserved.
950
950
  * Licensed under the MIT License.
@@ -1024,7 +1024,7 @@
1024
1024
  }
1025
1025
  }
1026
1026
 
1027
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1027
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1028
1028
 
1029
1029
  /*
1030
1030
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1182,7 +1182,7 @@
1182
1182
  }
1183
1183
  }
1184
1184
 
1185
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1185
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1186
1186
 
1187
1187
  /*
1188
1188
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1336,7 +1336,7 @@
1336
1336
  return null;
1337
1337
  }
1338
1338
 
1339
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1339
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1340
1340
  /*
1341
1341
  * Copyright (c) Microsoft Corporation. All rights reserved.
1342
1342
  * Licensed under the MIT License.
@@ -1345,7 +1345,7 @@
1345
1345
  // AzureCloudInstance is not specified.
1346
1346
  None: "none"};
1347
1347
 
1348
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1348
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1349
1349
  /*
1350
1350
  * Copyright (c) Microsoft Corporation. All rights reserved.
1351
1351
  * Licensed under the MIT License.
@@ -1355,7 +1355,7 @@
1355
1355
  response.hasOwnProperty("metadata"));
1356
1356
  }
1357
1357
 
1358
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1358
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1359
1359
  /*
1360
1360
  * Copyright (c) Microsoft Corporation. All rights reserved.
1361
1361
  * Licensed under the MIT License.
@@ -1365,7 +1365,7 @@
1365
1365
  response.hasOwnProperty("error_description"));
1366
1366
  }
1367
1367
 
1368
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1368
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1369
1369
  /*
1370
1370
  * Copyright (c) Microsoft Corporation. All rights reserved.
1371
1371
  * Licensed under the MIT License.
@@ -1436,7 +1436,7 @@
1436
1436
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1437
1437
  const SetUserData = "setUserData";
1438
1438
 
1439
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1439
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1440
1440
  /*
1441
1441
  * Copyright (c) Microsoft Corporation. All rights reserved.
1442
1442
  * Licensed under the MIT License.
@@ -1529,7 +1529,7 @@
1529
1529
  };
1530
1530
  };
1531
1531
 
1532
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1532
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1533
1533
 
1534
1534
  /*
1535
1535
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1640,7 +1640,7 @@
1640
1640
  },
1641
1641
  };
1642
1642
 
1643
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1643
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1644
1644
  /*
1645
1645
  * Copyright (c) Microsoft Corporation. All rights reserved.
1646
1646
  * Licensed under the MIT License.
@@ -1705,7 +1705,7 @@
1705
1705
  return cachedAtSec > nowSeconds();
1706
1706
  }
1707
1707
 
1708
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1708
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1709
1709
 
1710
1710
  /*
1711
1711
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1992,7 +1992,7 @@
1992
1992
  return [...attributeTokens].sort().join(" ");
1993
1993
  }
1994
1994
 
1995
- /*! @azure/msal-common v16.16.0 2026-11-05 */
1995
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
1996
1996
 
1997
1997
  /*
1998
1998
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2960,7 +2960,7 @@
2960
2960
  };
2961
2961
  }
2962
2962
 
2963
- /*! @azure/msal-common v16.16.0 2026-11-05 */
2963
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
2964
2964
 
2965
2965
  /*
2966
2966
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2994,7 +2994,7 @@
2994
2994
  }
2995
2995
  }
2996
2996
 
2997
- /*! @azure/msal-common v16.16.0 2026-11-05 */
2997
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
2998
2998
 
2999
2999
  /*
3000
3000
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3190,7 +3190,7 @@
3190
3190
  }
3191
3191
  }
3192
3192
 
3193
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3193
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3194
3194
 
3195
3195
  /*
3196
3196
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3690,7 +3690,7 @@
3690
3690
  }
3691
3691
  }
3692
3692
 
3693
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3693
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3694
3694
 
3695
3695
  /*
3696
3696
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3821,7 +3821,7 @@
3821
3821
  }
3822
3822
  }
3823
3823
 
3824
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3824
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3825
3825
 
3826
3826
  /*
3827
3827
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3869,7 +3869,7 @@
3869
3869
  },
3870
3870
  };
3871
3871
 
3872
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3872
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3873
3873
 
3874
3874
  /*
3875
3875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3892,7 +3892,7 @@
3892
3892
  },
3893
3893
  };
3894
3894
 
3895
- /*! @azure/msal-common v16.16.0 2026-11-05 */
3895
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
3896
3896
  /*
3897
3897
  * Copyright (c) Microsoft Corporation. All rights reserved.
3898
3898
  * Licensed under the MIT License.
@@ -4167,12 +4167,12 @@
4167
4167
  }
4168
4168
  }
4169
4169
 
4170
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4170
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4171
4171
  /* eslint-disable header/header */
4172
4172
  const name$1 = "@azure/msal-common";
4173
- const version$1 = "16.16.0";
4173
+ const version$1 = "16.16.1";
4174
4174
 
4175
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4175
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4176
4176
  /*
4177
4177
  * Copyright (c) Microsoft Corporation. All rights reserved.
4178
4178
  * Licensed under the MIT License.
@@ -4180,7 +4180,7 @@
4180
4180
  const cacheQuotaExceeded = "cache_quota_exceeded";
4181
4181
  const cacheErrorUnknown = "cache_error_unknown";
4182
4182
 
4183
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4183
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4184
4184
 
4185
4185
  /*
4186
4186
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4218,7 +4218,7 @@
4218
4218
  }
4219
4219
  }
4220
4220
 
4221
- /*! @azure/msal-common v16.16.0 2026-11-05 */
4221
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
4222
4222
 
4223
4223
  /*
4224
4224
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4682,19 +4682,25 @@
4682
4682
  * @param account
4683
4683
  */
4684
4684
  removeAccount(account, correlationId) {
4685
- this.removeAccountContext(account, correlationId);
4686
4685
  const accountKeys = this.getAccountKeys();
4687
4686
  const keyFilter = (key) => {
4688
4687
  return (key.includes(account.homeAccountId) &&
4689
4688
  key.includes(account.environment));
4690
4689
  };
4690
+ this.getTokenKeys()
4691
+ .idToken.filter(keyFilter)
4692
+ .forEach((key) => {
4693
+ this.removeIdToken(key, correlationId);
4694
+ });
4695
+ this.removeAccountContext(account, correlationId);
4691
4696
  accountKeys.filter(keyFilter).forEach((key) => {
4692
4697
  this.removeItem(key, correlationId);
4693
4698
  this.performanceClient.incrementFields({ accountsRemoved: 1 }, correlationId);
4694
4699
  });
4695
4700
  }
4696
4701
  /**
4697
- * Removes credentials associated with the provided account
4702
+ * Removes access and refresh tokens associated with the provided account,
4703
+ * preserving the account and its ID tokens.
4698
4704
  * @param account
4699
4705
  */
4700
4706
  removeAccountContext(account, correlationId) {
@@ -4703,9 +4709,6 @@
4703
4709
  return (key.includes(account.homeAccountId) &&
4704
4710
  key.includes(account.environment));
4705
4711
  };
4706
- allTokenKeys.idToken.filter(keyFilter).forEach((key) => {
4707
- this.removeIdToken(key, correlationId);
4708
- });
4709
4712
  allTokenKeys.accessToken.filter(keyFilter).forEach((key) => {
4710
4713
  this.removeAccessToken(key, correlationId);
4711
4714
  });
@@ -5442,7 +5445,7 @@
5442
5445
  }
5443
5446
  }
5444
5447
 
5445
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5448
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5446
5449
  /*
5447
5450
  * Copyright (c) Microsoft Corporation. All rights reserved.
5448
5451
  * Licensed under the MIT License.
@@ -5456,7 +5459,7 @@
5456
5459
  const PerformanceEventStatus = {
5457
5460
  InProgress: 1};
5458
5461
 
5459
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5462
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5460
5463
 
5461
5464
  /*
5462
5465
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5514,7 +5517,7 @@
5514
5517
  }
5515
5518
  }
5516
5519
 
5517
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5520
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5518
5521
 
5519
5522
  /*
5520
5523
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5612,7 +5615,7 @@
5612
5615
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5613
5616
  }
5614
5617
 
5615
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5618
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5616
5619
  /*
5617
5620
  * Copyright (c) Microsoft Corporation. All rights reserved.
5618
5621
  * Licensed under the MIT License.
@@ -5639,7 +5642,7 @@
5639
5642
  }
5640
5643
  }
5641
5644
 
5642
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5645
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5643
5646
 
5644
5647
  /*
5645
5648
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5660,7 +5663,7 @@
5660
5663
  return new JoseHeaderError(code, correlationId);
5661
5664
  }
5662
5665
 
5663
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5666
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5664
5667
  /*
5665
5668
  * Copyright (c) Microsoft Corporation. All rights reserved.
5666
5669
  * Licensed under the MIT License.
@@ -5685,7 +5688,7 @@
5685
5688
  return Object.getPrototypeOf(value) === proto;
5686
5689
  }
5687
5690
 
5688
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5691
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5689
5692
  /*
5690
5693
  * Copyright (c) Microsoft Corporation. All rights reserved.
5691
5694
  * Licensed under the MIT License.
@@ -5695,7 +5698,7 @@
5695
5698
  const missingJwkError = "missing_jwk_error";
5696
5699
  const invalidJwkError = "invalid_jwk_error";
5697
5700
 
5698
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5701
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5699
5702
 
5700
5703
  /*
5701
5704
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5761,7 +5764,7 @@
5761
5764
  }
5762
5765
  }
5763
5766
 
5764
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5767
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5765
5768
 
5766
5769
  /*
5767
5770
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5862,7 +5865,7 @@
5862
5865
  }
5863
5866
  }
5864
5867
 
5865
- /*! @azure/msal-common v16.16.0 2026-11-05 */
5868
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
5866
5869
 
5867
5870
  /*
5868
5871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6017,7 +6020,7 @@
6017
6020
  }
6018
6021
  }
6019
6022
 
6020
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6023
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6021
6024
  /*
6022
6025
  * Copyright (c) Microsoft Corporation. All rights reserved.
6023
6026
  * Licensed under the MIT License.
@@ -6068,7 +6071,7 @@
6068
6071
  */
6069
6072
  const interruptedUser = "interrupted_user";
6070
6073
 
6071
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6074
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6072
6075
 
6073
6076
  /*
6074
6077
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6135,7 +6138,7 @@
6135
6138
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6136
6139
  }
6137
6140
 
6138
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6141
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6139
6142
 
6140
6143
  /*
6141
6144
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6154,7 +6157,7 @@
6154
6157
  }
6155
6158
  }
6156
6159
 
6157
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6160
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6158
6161
 
6159
6162
  /*
6160
6163
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6225,7 +6228,7 @@
6225
6228
  }
6226
6229
  }
6227
6230
 
6228
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6231
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6229
6232
 
6230
6233
  /*
6231
6234
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6653,7 +6656,7 @@
6653
6656
  return baseAccount;
6654
6657
  }
6655
6658
 
6656
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6659
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6657
6660
  /*
6658
6661
  * Copyright (c) Microsoft Corporation. All rights reserved.
6659
6662
  * Licensed under the MIT License.
@@ -6663,7 +6666,7 @@
6663
6666
  UPN: "UPN",
6664
6667
  };
6665
6668
 
6666
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6669
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6667
6670
  /*
6668
6671
  * Copyright (c) Microsoft Corporation. All rights reserved.
6669
6672
  * Licensed under the MIT License.
@@ -6682,7 +6685,7 @@
6682
6685
  }
6683
6686
  }
6684
6687
 
6685
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6688
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6686
6689
 
6687
6690
  /*
6688
6691
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6706,7 +6709,7 @@
6706
6709
  };
6707
6710
  }
6708
6711
 
6709
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6712
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6710
6713
 
6711
6714
  /*
6712
6715
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6796,7 +6799,7 @@
6796
6799
  return undefined;
6797
6800
  }
6798
6801
 
6799
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6802
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6800
6803
 
6801
6804
  /*
6802
6805
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6827,7 +6830,7 @@
6827
6830
  return new NetworkError(error, httpStatus, responseHeaders);
6828
6831
  }
6829
6832
 
6830
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6833
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6831
6834
 
6832
6835
  /*
6833
6836
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6961,7 +6964,7 @@
6961
6964
  return response;
6962
6965
  }
6963
6966
 
6964
- /*! @azure/msal-common v16.16.0 2026-11-05 */
6967
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
6965
6968
 
6966
6969
  /*
6967
6970
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7228,7 +7231,7 @@
7228
7231
  }
7229
7232
  }
7230
7233
 
7231
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7234
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7232
7235
 
7233
7236
  /*
7234
7237
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7458,7 +7461,7 @@
7458
7461
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7459
7462
  }
7460
7463
 
7461
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7464
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7462
7465
 
7463
7466
  /*
7464
7467
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7693,7 +7696,7 @@
7693
7696
  }
7694
7697
  }
7695
7698
 
7696
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7699
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7697
7700
 
7698
7701
  /*
7699
7702
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7986,7 +7989,7 @@
7986
7989
  clearNativeBrokerErrorCode() { }
7987
7990
  }
7988
7991
 
7989
- /*! @azure/msal-common v16.16.0 2026-11-05 */
7992
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
7990
7993
 
7991
7994
  /*
7992
7995
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8113,7 +8116,7 @@
8113
8116
  }
8114
8117
  }
8115
8118
 
8116
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8119
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
8117
8120
 
8118
8121
  /*
8119
8122
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8129,7 +8132,7 @@
8129
8132
  },
8130
8133
  };
8131
8134
 
8132
- /*! @azure/msal-common v16.16.0 2026-11-05 */
8135
+ /*! @azure/msal-common v16.16.1 2026-11-06 */
8133
8136
 
8134
8137
  /*
8135
8138
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8315,6 +8318,7 @@
8315
8318
  constructor(argName, correlationId) {
8316
8319
  const errorDescription = `The argument '${argName}' is invalid.`;
8317
8320
  super("invalid_argument", errorDescription, correlationId);
8321
+ this.argName = argName;
8318
8322
  Object.setPrototypeOf(this, InvalidArgumentError.prototype);
8319
8323
  }
8320
8324
  }
@@ -8350,11 +8354,11 @@
8350
8354
  * Licensed under the MIT License.
8351
8355
  */
8352
8356
  const PASSWORD_TOO_WEAK$1 = "password_too_weak";
8353
- const PASSWORD_TOO_SHORT = "password_too_short";
8354
- const PASSWORD_TOO_LONG = "password_too_long";
8355
- const PASSWORD_RECENTLY_USED = "password_recently_used";
8356
- const PASSWORD_BANNED = "password_banned";
8357
- const PASSWORD_IS_INVALID = "password_is_invalid";
8357
+ const PASSWORD_TOO_SHORT$1 = "password_too_short";
8358
+ const PASSWORD_TOO_LONG$1 = "password_too_long";
8359
+ const PASSWORD_RECENTLY_USED$1 = "password_recently_used";
8360
+ const PASSWORD_BANNED$1 = "password_banned";
8361
+ const PASSWORD_IS_INVALID$1 = "password_is_invalid";
8358
8362
  const INVALID_OOB_VALUE = "invalid_oob_value";
8359
8363
  const ATTRIBUTE_VALIATION_FAILED = "attribute_validation_failed";
8360
8364
  const REGISTRATION_REQUIRED = "registration_required";
@@ -8412,11 +8416,11 @@
8412
8416
  }
8413
8417
  isInvalidNewPasswordError() {
8414
8418
  const invalidPasswordSubErrors = new Set([
8415
- PASSWORD_BANNED,
8416
- PASSWORD_IS_INVALID,
8417
- PASSWORD_RECENTLY_USED,
8418
- PASSWORD_TOO_LONG,
8419
- PASSWORD_TOO_SHORT,
8419
+ PASSWORD_BANNED$1,
8420
+ PASSWORD_IS_INVALID$1,
8421
+ PASSWORD_RECENTLY_USED$1,
8422
+ PASSWORD_TOO_LONG$1,
8423
+ PASSWORD_TOO_SHORT$1,
8420
8424
  PASSWORD_TOO_WEAK$1,
8421
8425
  ]);
8422
8426
  return (this.errorData instanceof CustomAuthApiError &&
@@ -8561,11 +8565,26 @@
8561
8565
  !argValue.every((value) => typeof value === "string")) {
8562
8566
  throw new InvalidArgumentError(argName, correlationId);
8563
8567
  }
8568
+ }
8569
+ function filterReservedSignUpAttributesV2(attributes, logger, correlationId) {
8570
+ const reservedSignUpAttributeNames = new Set(["email", "password"]);
8571
+ const reservedSignUpAttributeWarning = "Ignoring app-supplied sign-up attribute because it uses a reserved SDK attribute name.";
8572
+ const filteredAttributes = [];
8573
+ for (const [attributeId, value] of Object.entries(attributes ?? {})) {
8574
+ if (reservedSignUpAttributeNames.has(attributeId.toLowerCase())) {
8575
+ logger.warning(reservedSignUpAttributeWarning, correlationId);
8576
+ continue;
8577
+ }
8578
+ if (value !== undefined) {
8579
+ filteredAttributes.push([attributeId, value]);
8580
+ }
8581
+ }
8582
+ return Object.fromEntries(filteredAttributes);
8564
8583
  }
8565
8584
 
8566
8585
  /* eslint-disable header/header */
8567
8586
  const name = "@azure/msal-browser";
8568
- const version = "5.28.0";
8587
+ const version = "5.29.0";
8569
8588
 
8570
8589
  /*
8571
8590
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11713,6 +11732,7 @@
11713
11732
  const SIGN_IN_V2_SUBMIT_CODE = 100210;
11714
11733
  const SIGN_UP_V2_START = 100211;
11715
11734
  const SIGN_UP_V2_CHALLENGE = 100212;
11735
+ const SIGN_UP_V2_SUBMIT_PASSWORD = 100223;
11716
11736
  const SIGN_UP_V2_SUBMIT_CODE = 100213;
11717
11737
  const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
11718
11738
  const SIGN_UP_V2_RESEND_CODE = 100215;
@@ -12516,12 +12536,7 @@
12516
12536
  * Licensed under the MIT License.
12517
12537
  */
12518
12538
  /*
12519
- * Turns a raw HTTP response from a V2 endpoint into a typed, checked envelope, and validates HAL
12520
- * relations. Raw-preserving: the body keeps its HAL `_links`/`_embedded` shape so the api-client
12521
- * navigates typed hrefs directly. Parsing never throws on a non-200 status - every V2 response
12522
- * (including the entry response) carries a meaningful body, so only a non-object body is a hard
12523
- * failure; the wire error is normalized onto the envelope (`error`). Required response values use
12524
- * shared guards after callers read their strongly typed response properties directly.
12539
+ * Parses V2 HTTP responses and validates required response values.
12525
12540
  */
12526
12541
  class ResponseHandlerV2 {
12527
12542
  constructor(logger) {
@@ -12539,7 +12554,6 @@
12539
12554
  : undefined);
12540
12555
  const error = normalizeServerErrorV2(json);
12541
12556
  const isWebFallbackRequired = error?.subError === WEB_REDIRECT_REQUIRED;
12542
- // Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
12543
12557
  json.correlationId = correlationId;
12544
12558
  return {
12545
12559
  statusCode: response.status,
@@ -12569,6 +12583,24 @@
12569
12583
  }
12570
12584
  return continuationToken;
12571
12585
  }
12586
+ resolveSignUpAttributes(attributes, correlationId) {
12587
+ const resolved = attributes === undefined ? [] : attributes;
12588
+ if (!Array.isArray(resolved) ||
12589
+ resolved.some((attribute) => typeof attribute !== "object" ||
12590
+ attribute === null ||
12591
+ typeof attribute.attributeId !== "string" ||
12592
+ !attribute.attributeId.trim())) {
12593
+ const message = "Invalid HAL response: sign-up attributes must be an array of objects with nonempty string attributeId values";
12594
+ this.logger?.error(message, correlationId);
12595
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
12596
+ }
12597
+ if (resolved.some((attribute) => attribute.attributeId.toLowerCase() === "email")) {
12598
+ const message = "Invalid HAL response: email cannot be collected as a sign-up attribute";
12599
+ this.logger?.error(message, correlationId);
12600
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
12601
+ }
12602
+ return resolved;
12603
+ }
12572
12604
  // Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
12573
12605
  requireMethods(methods, correlationId) {
12574
12606
  if (!methods?.length) {
@@ -12586,7 +12618,6 @@
12586
12618
  this.logger?.error("V2 response serialization failed: body is not valid JSON", correlationId);
12587
12619
  throw new CustomAuthApiError(INVALID_RESPONSE_BODY, `V2 response body is not valid JSON: '${e}'`, correlationId);
12588
12620
  }
12589
- // response.json() accepts primitives/arrays; every V2 body must be a JSON object.
12590
12621
  if (typeof json !== "object" || json === null || Array.isArray(json)) {
12591
12622
  this.logger?.error("V2 response serialization failed: body is not a JSON object", correlationId);
12592
12623
  throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "V2 response body is not a JSON object", correlationId);
@@ -12658,9 +12689,7 @@
12658
12689
  * Copyright (c) Microsoft Corporation. All rights reserved.
12659
12690
  * Licensed under the MIT License.
12660
12691
  */
12661
- // Content type used by V2 JSON `/api` requests.
12662
12692
  const JSON_CONTENT_TYPE = "application/json";
12663
- // Server action returned after successful credential verification.
12664
12693
  const UPDATE_RELATION = "update";
12665
12694
  const CHALLENGE_RELATION = "challenge";
12666
12695
  const VERIFY_RELATION = "verify";
@@ -12679,10 +12708,6 @@
12679
12708
  const PhoneRegistrationChannelV2 = {
12680
12709
  SMS: "sms",
12681
12710
  };
12682
- /*
12683
- * Known `state` values on a HAL response. Kept open (the body field is typed as string) because
12684
- * the server may introduce new values; response parsing and flow logic branch on these constants.
12685
- */
12686
12711
  const ResponseStateV2 = {
12687
12712
  CONTINUE: "continue",
12688
12713
  };
@@ -12901,7 +12926,6 @@
12901
12926
  * Licensed under the MIT License.
12902
12927
  */
12903
12928
  const SignUpSubmitAttributesNextActionV2 = {
12904
- VERIFY: "verify",
12905
12929
  COLLECT_ATTRIBUTES: "collectAttributes",
12906
12930
  CONTINUE: "continue",
12907
12931
  ENROLL: "enroll",
@@ -12913,7 +12937,6 @@
12913
12937
  */
12914
12938
  /*
12915
12939
  * Native Auth V2 network client that follows server-provided HAL links.
12916
- * Flow-specific entry methods reuse shared challenge, verification, and token operations.
12917
12940
  */
12918
12941
  class CustomAuthApiClientV2 extends BaseApiClientV2 {
12919
12942
  /*
@@ -12934,15 +12957,30 @@
12934
12957
  */
12935
12958
  async signUpStart(signUpHref, request, context) {
12936
12959
  const parsedResponse = await this.sendActionRequest(signUpHref, HttpMethod.POST, request, context);
12937
- return {
12938
- continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
12939
- submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", parsedResponse.correlationId),
12940
- attributes: parsedResponse.body.attributes,
12941
- };
12960
+ const challengeType = parsedResponse.body.action === VERIFY_RELATION
12961
+ ? parsedResponse.body.type
12962
+ : undefined;
12963
+ const isEmailChallenge = typeof challengeType === "string" &&
12964
+ challengeType.toLowerCase() === AuthenticationMethodTypeV2.EMAIL;
12965
+ if (parsedResponse.body.action === VERIFY_RELATION &&
12966
+ isEmailChallenge) {
12967
+ return this.toChallengeVerificationResult(parsedResponse);
12968
+ }
12969
+ if (parsedResponse.body.action === CHALLENGE_RELATION) {
12970
+ return {
12971
+ nextAction: CHALLENGE_RELATION,
12972
+ continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
12973
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, parsedResponse.correlationId), parsedResponse.correlationId),
12974
+ authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
12975
+ scenario: parsedResponse.body.scenario,
12976
+ };
12977
+ }
12978
+ const message = "Invalid HAL response: sign-up start did not return an email verification or authentication challenge";
12979
+ this.logger?.error(message, parsedResponse.correlationId);
12980
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, parsedResponse.correlationId);
12942
12981
  }
12943
12982
  /*
12944
- * Submits the initial sign-up attributes. A successful response has already
12945
- * sent the email code and supplies the links needed to verify or resend it.
12983
+ * Submits the initial sign-up attributes.
12946
12984
  */
12947
12985
  async submitSignUpAttributes(submitAttributesHref, request, context) {
12948
12986
  const parsedResponse = await this.sendActionRequest(submitAttributesHref, HttpMethod.POST, request, context);
@@ -12958,16 +12996,10 @@
12958
12996
  return {
12959
12997
  nextAction: SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES,
12960
12998
  continuationToken,
12961
- attributes: parsedResponse.body.attributes ?? [],
12999
+ attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
12962
13000
  submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
12963
13001
  };
12964
13002
  }
12965
- if (parsedResponse.body.action === VERIFY_RELATION) {
12966
- return {
12967
- ...this.toChallengeVerificationResult(parsedResponse),
12968
- attributes: parsedResponse.body.attributes,
12969
- };
12970
- }
12971
13003
  if (parsedResponse.body.action === ENROLL_RELATION) {
12972
13004
  return {
12973
13005
  nextAction: ENROLL_RELATION,
@@ -13060,7 +13092,15 @@
13060
13092
  return {
13061
13093
  nextAction,
13062
13094
  continuationToken,
13063
- enrollmentMethods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13095
+ methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13096
+ };
13097
+ }
13098
+ if (nextAction === CHALLENGE_RELATION) {
13099
+ return {
13100
+ nextAction,
13101
+ continuationToken,
13102
+ authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
13103
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13064
13104
  };
13065
13105
  }
13066
13106
  if (nextAction === POLL_RELATION) {
@@ -13103,7 +13143,7 @@
13103
13143
  return {
13104
13144
  nextAction: COLLECT_ATTRIBUTES_RELATION,
13105
13145
  continuationToken,
13106
- attributes: parsedResponse.body.attributes ?? [],
13146
+ attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
13107
13147
  submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
13108
13148
  };
13109
13149
  }
@@ -13229,9 +13269,7 @@
13229
13269
  * Licensed under the MIT License.
13230
13270
  */
13231
13271
  /*
13232
- * Shared base for Native Auth V2 interaction clients. It extends
13233
- * `StandardInteractionClient` for common browser infrastructure while keeping
13234
- * V1 and V2 token handling independent.
13272
+ * Shared base for Native Auth V2 interaction clients.
13235
13273
  */
13236
13274
  class InteractionClientBaseV2 extends StandardInteractionClient {
13237
13275
  constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority) {
@@ -13239,13 +13277,11 @@
13239
13277
  this.customAuthAuthority = customAuthAuthority;
13240
13278
  this.tokenResponseHandler = new ResponseHandler(this.config.auth.clientId, this.browserStorage, this.browserCrypto, this.logger, this.performanceClient, null, null);
13241
13279
  }
13242
- // Required by the base contract. After sign-in, use CustomAuthAccountData.getAccessToken().
13243
13280
  acquireToken(
13244
13281
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13245
13282
  request) {
13246
13283
  throw new MethodNotImplementedError("InteractionClientBaseV2.acquireToken");
13247
13284
  }
13248
- // Required by the base contract. After sign-in, use CustomAuthAccountData.signOut().
13249
13285
  logout(
13250
13286
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
13251
13287
  request) {
@@ -13289,9 +13325,10 @@
13289
13325
  * Copyright (c) Microsoft Corporation. All rights reserved.
13290
13326
  * Licensed under the MIT License.
13291
13327
  */
13292
- // Result type discriminators.
13293
13328
  const FLOW_METHOD_SELECTION_REQUIRED_V2 = "FlowMethodSelectionRequiredResultV2";
13294
13329
  const FLOW_CODE_REQUIRED_V2 = "FlowCodeRequiredResultV2";
13330
+ const FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2 = "FlowExistingAccountCodeRequiredResultV2";
13331
+ const FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2 = "FlowExistingAccountPasswordRequiredResultV2";
13295
13332
  const FLOW_PASSWORD_REQUIRED_V2 = "FlowPasswordRequiredResultV2";
13296
13333
  const FLOW_SIGN_UP_PASSWORD_REQUIRED_V2 = "FlowSignUpPasswordRequiredResultV2";
13297
13334
  const FLOW_MFA_REQUIRED_V2 = "FlowMFARequiredResultV2";
@@ -13307,6 +13344,12 @@
13307
13344
  function createFlowCodeRequiredResultV2(input) {
13308
13345
  return { type: FLOW_CODE_REQUIRED_V2, ...input };
13309
13346
  }
13347
+ function createFlowExistingAccountCodeRequiredResultV2(input) {
13348
+ return { type: FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2, ...input };
13349
+ }
13350
+ function createFlowExistingAccountPasswordRequiredResultV2(input) {
13351
+ return { type: FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2, ...input };
13352
+ }
13310
13353
  function createFlowPasswordRequiredResultV2(input) {
13311
13354
  return { type: FLOW_PASSWORD_REQUIRED_V2, ...input };
13312
13355
  }
@@ -13340,10 +13383,8 @@
13340
13383
  * Licensed under the MIT License.
13341
13384
  */
13342
13385
  /**
13343
- * The native auth V2 flow that a result or error originates from (sign-in,
13344
- * sign-up, or password reset). It lets a shared result or error type report
13345
- * which entry flow produced it; `Unknown` is used when the flow cannot be
13346
- * determined.
13386
+ * The native auth V2 flow that a result or error originates from.
13387
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
13347
13388
  */
13348
13389
  const CustomAuthFlowScenarioV2 = {
13349
13390
  SignIn: "signIn",
@@ -13374,6 +13415,7 @@
13374
13415
  [CustomAuthFlowScenarioV2.SignUp]: {
13375
13416
  requestChallenge: SIGN_UP_V2_CHALLENGE,
13376
13417
  submitCode: SIGN_UP_V2_SUBMIT_CODE,
13418
+ submitPassword: SIGN_UP_V2_SUBMIT_PASSWORD,
13377
13419
  resendCode: SIGN_UP_V2_RESEND_CODE,
13378
13420
  submitAttributes: SIGN_UP_V2_SUBMIT_ATTRIBUTES,
13379
13421
  signInWithContinuation: SIGN_UP_V2_COMPLETE,
@@ -13384,12 +13426,9 @@
13384
13426
  submitCode: MFA_V2_SUBMIT_CHALLENGE,
13385
13427
  resendCode: MFA_V2_RESEND_CHALLENGE,
13386
13428
  };
13387
- /**
13388
- * Resolves the telemetry API ID for a flow step. MFA challenge operations use
13389
- * distinct IDs when the sign-in caller identifies the second factor.
13390
- */
13391
13429
  function getPublicApiIdV2(scenario, step, authenticationFactor) {
13392
- if (scenario === CustomAuthFlowScenarioV2.SignIn &&
13430
+ if ((scenario === CustomAuthFlowScenarioV2.SignIn ||
13431
+ scenario === CustomAuthFlowScenarioV2.PasswordReset) &&
13393
13432
  authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
13394
13433
  return (MFA_STEP_API_IDS_V2[step] ?? FLOW_STEP_API_IDS_V2[scenario]?.[step]);
13395
13434
  }
@@ -13400,17 +13439,12 @@
13400
13439
  * Copyright (c) Microsoft Corporation. All rights reserved.
13401
13440
  * Licensed under the MIT License.
13402
13441
  */
13403
- /*
13404
- * Polls up to five times for password-update completion, waiting 1.5 seconds
13405
- * between attempts. The first request runs immediately.
13406
- */
13407
13442
  const POLL_MAX_ATTEMPTS = 5;
13408
13443
  // TODO: Replace this fallback with the server-provided polling interval once available.
13409
13444
  const POLL_INTERVAL_MS = 1500;
13410
13445
  const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
13411
13446
  /*
13412
- * Drives server-directed Native Auth V2 flows using opaque continuation state
13413
- * and HAL links. Each operation returns only its valid discriminated results.
13447
+ * Drives server-directed Native Auth V2 flows.
13414
13448
  */
13415
13449
  class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13416
13450
  constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority, apiClient) {
@@ -13418,8 +13452,7 @@
13418
13452
  this.apiClient = apiClient;
13419
13453
  }
13420
13454
  /*
13421
- * Starts sign-in by automatically using a sole supported method or returning
13422
- * multiple supported methods for user selection.
13455
+ * Starts native auth V2 sign-in.
13423
13456
  */
13424
13457
  async signIn(parameters) {
13425
13458
  const correlationId = parameters.correlationId;
@@ -13472,20 +13505,14 @@
13472
13505
  method: selectedMethod,
13473
13506
  };
13474
13507
  }
13475
- if (parameters.password) {
13476
- return this.submitSignInPassword({
13477
- correlationId,
13478
- continuationState: challengeResult.continuationState,
13479
- password: parameters.password,
13480
- });
13481
- }
13482
13508
  return challengeResult;
13483
13509
  }
13484
13510
  /*
13485
- * Starts sign-up and resolves the server-provided attribute-submission transition.
13511
+ * Starts native auth V2 sign-up.
13486
13512
  */
13487
13513
  async signUp(parameters) {
13488
13514
  const correlationId = parameters.correlationId;
13515
+ const pendingProfileAttributes = filterReservedSignUpAttributesV2(parameters.attributes, this.logger, correlationId);
13489
13516
  const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
13490
13517
  this.logger.verbose("Starting V2 sign-up.", correlationId);
13491
13518
  const scopes = this.getScopes(parameters.scopes);
@@ -13495,38 +13522,82 @@
13495
13522
  message: "The authorize-challenge entry response did not include a sign-up link.",
13496
13523
  }), {
13497
13524
  continuationToken: entryResult.continuationToken,
13525
+ username: parameters.username,
13498
13526
  }, context);
13499
- const attributes = Object.fromEntries(Object.entries(parameters.attributes ?? {}).filter(([name]) => name.toLowerCase() !== "email" &&
13500
- name.toLowerCase() !== "password"));
13501
- attributes.email = parameters.username;
13502
- if (parameters.password !== undefined) {
13503
- attributes.password = parameters.password;
13527
+ if (startResult.nextAction === VERIFY_RELATION) {
13528
+ if (startResult.type?.toLowerCase() !==
13529
+ AuthenticationMethodTypeV2.EMAIL) {
13530
+ const message = "New-account sign-up requires an email code challenge.";
13531
+ this.logger.error(message, correlationId);
13532
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13533
+ }
13534
+ return createFlowCodeRequiredResultV2({
13535
+ correlationId,
13536
+ continuationState: {
13537
+ continuationToken: startResult.continuationToken,
13538
+ scenario: CustomAuthFlowScenarioV2.SignUp,
13539
+ scopes,
13540
+ links: {
13541
+ verify: startResult.verifyHref,
13542
+ resend: startResult.resendHref,
13543
+ },
13544
+ signUp: {
13545
+ purpose: "newAccount",
13546
+ pendingProfileAttributes,
13547
+ submittedAttributeIds: [],
13548
+ },
13549
+ },
13550
+ channel: startResult.type,
13551
+ sentTo: startResult.hint,
13552
+ codeLength: startResult.codeLength,
13553
+ });
13504
13554
  }
13505
- const submitResult = await this.apiClient.submitSignUpAttributes(startResult.submitAttributesHref, {
13506
- continuationToken: startResult.continuationToken,
13507
- attributes,
13508
- }, context);
13509
13555
  const continuationState = {
13510
13556
  continuationToken: startResult.continuationToken,
13511
13557
  scenario: CustomAuthFlowScenarioV2.SignUp,
13512
13558
  scopes,
13513
13559
  links: {},
13514
13560
  signUp: {
13515
- passwordWasSupplied: attributes.password !== undefined,
13561
+ purpose: "existingAccount",
13516
13562
  },
13517
13563
  };
13518
- const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
13519
- if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 ||
13520
- result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
13521
- const message = `Initial sign-up attribute submission returned unsupported next action '${submitResult.nextAction}'.`;
13522
- this.logger.error(message, correlationId);
13523
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13564
+ this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "existing-account sign-up", correlationId);
13565
+ const supportedMethods = startResult.methods
13566
+ .map((method) => ({
13567
+ id: method.id,
13568
+ type: method.type ?? "",
13569
+ hint: method.hint,
13570
+ challengeHref: method.challengeHref,
13571
+ }))
13572
+ .filter((method) => {
13573
+ const methodType = method.type.toLowerCase();
13574
+ return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13575
+ methodType === AuthenticationMethodTypeV2.PASSWORD);
13576
+ });
13577
+ if (supportedMethods.length === 0) {
13578
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "The existing-account sign-up response must include an email or password method.", correlationId);
13524
13579
  }
13525
- return result;
13580
+ if (supportedMethods.length > 1) {
13581
+ return createFlowMethodSelectionRequiredResultV2({
13582
+ correlationId,
13583
+ continuationState,
13584
+ methods: supportedMethods,
13585
+ });
13586
+ }
13587
+ const selectedMethod = supportedMethods[0];
13588
+ const challengeResult = await this.requestChallenge({
13589
+ correlationId,
13590
+ continuationState: {
13591
+ ...continuationState,
13592
+ links: {
13593
+ challenge: selectedMethod.challengeHref,
13594
+ },
13595
+ },
13596
+ });
13597
+ return this.toExistingAccountChallengeResult(challengeResult, selectedMethod, correlationId);
13526
13598
  }
13527
13599
  /*
13528
- * Starts password reset, automatically challenging a sole method or
13529
- * returning multiple methods for selection.
13600
+ * Starts native auth V2 password reset.
13530
13601
  */
13531
13602
  async resetPassword(parameters) {
13532
13603
  const correlationId = parameters.correlationId;
@@ -13559,44 +13630,43 @@
13559
13630
  this.logger.error(message, correlationId);
13560
13631
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13561
13632
  }
13562
- if (methods.length === 1) {
13563
- const selectedMethod = methods[0];
13564
- const challengeResult = await this.requestChallenge({
13633
+ if (methods.length > 1) {
13634
+ this.logger.verbose("V2 self-service password reset method selection required.", correlationId);
13635
+ return createFlowMethodSelectionRequiredResultV2({
13565
13636
  correlationId,
13566
- continuationState: {
13567
- ...continuationState,
13568
- links: {
13569
- challenge: selectedMethod.challengeHref,
13570
- },
13571
- },
13637
+ continuationState,
13638
+ methods,
13572
13639
  });
13573
- if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
13574
- (challengeResult.channel?.toLowerCase() ===
13575
- AuthenticationMethodTypeV2.EMAIL ||
13576
- challengeResult.channel?.toLowerCase() ===
13577
- AuthenticationMethodTypeV2.SMS)) {
13578
- return {
13579
- ...challengeResult,
13580
- method: selectedMethod,
13581
- };
13582
- }
13583
- const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
13584
- ? challengeResult.channel
13585
- : AuthenticationMethodTypeV2.PASSWORD;
13586
- const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
13587
- this.logger.error(message, correlationId);
13588
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13589
13640
  }
13590
- this.logger.verbose("V2 self-service password reset method selection required.", correlationId);
13591
- return createFlowMethodSelectionRequiredResultV2({
13641
+ const selectedMethod = methods[0];
13642
+ const challengeResult = await this.requestChallenge({
13592
13643
  correlationId,
13593
- continuationState,
13594
- methods,
13644
+ continuationState: {
13645
+ ...continuationState,
13646
+ links: {
13647
+ challenge: selectedMethod.challengeHref,
13648
+ },
13649
+ },
13595
13650
  });
13651
+ if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
13652
+ (challengeResult.channel?.toLowerCase() ===
13653
+ AuthenticationMethodTypeV2.EMAIL ||
13654
+ challengeResult.channel?.toLowerCase() ===
13655
+ AuthenticationMethodTypeV2.SMS)) {
13656
+ return {
13657
+ ...challengeResult,
13658
+ method: selectedMethod,
13659
+ };
13660
+ }
13661
+ const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
13662
+ ? challengeResult.channel
13663
+ : AuthenticationMethodTypeV2.PASSWORD;
13664
+ const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
13665
+ this.logger.error(message, correlationId);
13666
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13596
13667
  }
13597
13668
  /*
13598
- * Requests a one-time code for the selected authentication method. Returns
13599
- * the continuation state and code metadata needed for verification.
13669
+ * Requests a challenge for the selected authentication method.
13600
13670
  */
13601
13671
  async requestChallenge(parameters) {
13602
13672
  const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
@@ -13626,7 +13696,7 @@
13626
13696
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13627
13697
  }
13628
13698
  /*
13629
- * Registers the selected offered method and returns activation metadata.
13699
+ * Registers the selected authentication method.
13630
13700
  */
13631
13701
  async registerAuthMethod(parameters) {
13632
13702
  const { continuationState, correlationId } = parameters;
@@ -13640,8 +13710,7 @@
13640
13710
  return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13641
13711
  }
13642
13712
  /*
13643
- * Activates the registered method and redeems the resulting continuation
13644
- * for tokens.
13713
+ * Activates the registered authentication method.
13645
13714
  */
13646
13715
  async verifyAuthMethodRegistration(parameters) {
13647
13716
  const { continuationState, correlationId } = parameters;
@@ -13651,11 +13720,22 @@
13651
13720
  continuationToken: continuationState.continuationToken,
13652
13721
  otp: parameters.code,
13653
13722
  }, context);
13723
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp ||
13724
+ continuationState.scenario ===
13725
+ CustomAuthFlowScenarioV2.PasswordReset) {
13726
+ return createFlowSignInContinuationRequiredResultV2({
13727
+ correlationId,
13728
+ continuationState: {
13729
+ ...continuationState,
13730
+ continuationToken: result.continuationToken,
13731
+ links: {},
13732
+ },
13733
+ });
13734
+ }
13654
13735
  return this.completeSignInAfterVerification(continuationState, result.continuationToken, correlationId);
13655
13736
  }
13656
13737
  /*
13657
- * Requests a replacement activation challenge through the server-provided
13658
- * resend link using the latest continuation token.
13738
+ * Requests a replacement authentication-method activation challenge.
13659
13739
  */
13660
13740
  async resendAuthMethodRegistrationChallenge(parameters) {
13661
13741
  const { continuationState, correlationId } = parameters;
@@ -13667,8 +13747,7 @@
13667
13747
  return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13668
13748
  }
13669
13749
  /*
13670
- * Verifies the submitted one-time code using the server-provided link. The
13671
- * response determines the next required action.
13750
+ * Verifies the submitted one-time code.
13672
13751
  */
13673
13752
  async submitCode(parameters) {
13674
13753
  const continuationState = parameters.continuationState;
@@ -13683,6 +13762,22 @@
13683
13762
  const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
13684
13763
  if (continuationState.scenario ===
13685
13764
  CustomAuthFlowScenarioV2.PasswordReset &&
13765
+ parameters.authenticationFactor ===
13766
+ AuthenticationFactorV2.MULTI_FACTOR &&
13767
+ verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13768
+ return createFlowSignInContinuationRequiredResultV2({
13769
+ correlationId,
13770
+ continuationState: {
13771
+ ...continuationState,
13772
+ continuationToken: verifyResult.continuationToken,
13773
+ links: {},
13774
+ },
13775
+ });
13776
+ }
13777
+ if (continuationState.scenario ===
13778
+ CustomAuthFlowScenarioV2.PasswordReset &&
13779
+ parameters.authenticationFactor !==
13780
+ AuthenticationFactorV2.MULTI_FACTOR &&
13686
13781
  verifyResult.nextAction === UPDATE_RELATION) {
13687
13782
  return createFlowNewPasswordRequiredResultV2({
13688
13783
  correlationId,
@@ -13697,6 +13792,10 @@
13697
13792
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
13698
13793
  return this.handleSignInVerification(continuationState, verifyResult, correlationId);
13699
13794
  }
13795
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
13796
+ continuationState.signUp?.purpose === "existingAccount") {
13797
+ return this.handleSignInVerification(continuationState, verifyResult, correlationId);
13798
+ }
13700
13799
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
13701
13800
  return this.handleSignUpVerification(continuationState, verifyResult, correlationId);
13702
13801
  }
@@ -13705,11 +13804,17 @@
13705
13804
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13706
13805
  }
13707
13806
  /*
13708
- * Requests a new one-time code using the server-provided resend link.
13709
- * Returns refreshed continuation state and code metadata.
13807
+ * Requests a replacement one-time code.
13710
13808
  */
13711
13809
  async resendCode(parameters) {
13712
13810
  const challengeResult = await this.sendMethodChallenge(parameters, "resendCode");
13811
+ const challengeType = challengeResult.type?.toLowerCase();
13812
+ if (challengeType !== AuthenticationMethodTypeV2.EMAIL &&
13813
+ challengeType !== AuthenticationMethodTypeV2.SMS) {
13814
+ const message = "A replacement code requires an email or SMS code challenge.";
13815
+ this.logger.error(message, parameters.correlationId);
13816
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13817
+ }
13713
13818
  return createFlowCodeRequiredResultV2({
13714
13819
  correlationId: parameters.correlationId,
13715
13820
  continuationState: this.createChallengeContinuationState(parameters.continuationState, challengeResult),
@@ -13719,24 +13824,31 @@
13719
13824
  });
13720
13825
  }
13721
13826
  async submitSignUpAttributes(parameters) {
13722
- const { continuationState, correlationId, attributes } = parameters;
13827
+ const { continuationState, correlationId, attributes: submittedAttributes, } = parameters;
13723
13828
  const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitAttributes", correlationId), correlationId);
13724
13829
  this.logger.verbose("Submitting additional V2 sign-up attributes.", correlationId);
13830
+ const submittedAttributeIds = Object.keys(submittedAttributes);
13725
13831
  const submitResult = await this.apiClient.submitSignUpAttributes(this.requireLink(correlationId, continuationState.links.submitAttributes), {
13726
13832
  continuationToken: continuationState.continuationToken,
13727
- attributes,
13833
+ attributes: submittedAttributes,
13728
13834
  }, context);
13729
- return this.toSignUpActionResult(submitResult, {
13835
+ return this.toSignUpSubmitAttributesResult(submitResult, {
13730
13836
  ...continuationState,
13731
13837
  signUp: {
13732
- passwordWasSupplied: continuationState.signUp?.passwordWasSupplied ===
13733
- true || attributes.password !== undefined,
13838
+ purpose: "newAccount",
13839
+ submittedAttributeIds: [
13840
+ ...new Set([
13841
+ ...(continuationState.signUp
13842
+ ?.submittedAttributeIds ?? []),
13843
+ ...submittedAttributeIds,
13844
+ ]),
13845
+ ],
13734
13846
  },
13735
13847
  }, correlationId);
13736
13848
  }
13737
13849
  /*
13738
- * Submits the new password and polls until the reset completes. The result
13739
- * contains the continuation state required for explicit sign-in.
13850
+ * Submits the new password and polls for the next action: method registration,
13851
+ * MFA, or a continuation for explicit sign-in.
13740
13852
  */
13741
13853
  async submitNewPassword(parameters) {
13742
13854
  const continuationState = parameters.continuationState;
@@ -13754,7 +13866,7 @@
13754
13866
  for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
13755
13867
  pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
13756
13868
  isPolling = pollResult.nextAction === POLL_RELATION;
13757
- if (!isPolling) {
13869
+ if (pollResult.nextAction !== POLL_RELATION) {
13758
13870
  break;
13759
13871
  }
13760
13872
  pollToken = pollResult.continuationToken;
@@ -13768,8 +13880,7 @@
13768
13880
  this.logger.error(message, correlationId);
13769
13881
  throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
13770
13882
  }
13771
- if (pollResult.nextAction === ENROLL_RELATION &&
13772
- pollResult.enrollmentMethods) {
13883
+ if (pollResult.nextAction === ENROLL_RELATION && pollResult.methods) {
13773
13884
  return this.createAuthMethodRegistrationRequiredResult({
13774
13885
  correlationId,
13775
13886
  continuationState: {
@@ -13777,7 +13888,30 @@
13777
13888
  continuationToken: pollResult.continuationToken,
13778
13889
  links: {},
13779
13890
  },
13780
- methods: pollResult.enrollmentMethods,
13891
+ methods: pollResult.methods,
13892
+ });
13893
+ }
13894
+ if (pollResult.nextAction === CHALLENGE_RELATION) {
13895
+ if (!pollResult.authenticationFactor) {
13896
+ const message = "Password-reset MFA challenge is missing its authentication factor.";
13897
+ this.logger.error(message, correlationId);
13898
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13899
+ }
13900
+ this.ensureAuthenticationFactor(pollResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after password reset", correlationId);
13901
+ return createFlowMFARequiredResultV2({
13902
+ correlationId,
13903
+ continuationState: {
13904
+ continuationToken: pollResult.continuationToken,
13905
+ scenario: continuationState.scenario,
13906
+ scopes: continuationState.scopes,
13907
+ links: {},
13908
+ },
13909
+ methods: pollResult.methods.map((method) => ({
13910
+ id: method.id,
13911
+ type: method.type ?? "",
13912
+ hint: method.hint,
13913
+ challengeHref: method.challengeHref,
13914
+ })),
13781
13915
  });
13782
13916
  }
13783
13917
  if (pollResult.nextAction === ResponseStateV2.CONTINUE) {
@@ -13797,15 +13931,14 @@
13797
13931
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13798
13932
  }
13799
13933
  /*
13800
- * Verifies a sign-in password and returns the next sign-in action.
13934
+ * Verifies the sign-in password.
13801
13935
  */
13802
13936
  async submitSignInPassword(parameters) {
13803
13937
  const verifyResult = await this.verifySignInPassword(parameters);
13804
13938
  return this.handleSignInVerification(parameters.continuationState, verifyResult, parameters.correlationId);
13805
13939
  }
13806
13940
  /*
13807
- * Redeems the completed flow continuation for tokens. Returns the
13808
- * authentication result after validating and caching the response.
13941
+ * Signs the user in from a completed flow.
13809
13942
  */
13810
13943
  async signInWithContinuation(parameters) {
13811
13944
  const continuationState = parameters.continuationState;
@@ -13836,13 +13969,12 @@
13836
13969
  });
13837
13970
  }
13838
13971
  if (verifyResult.nextAction === CHALLENGE_RELATION) {
13839
- this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
13972
+ this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after authentication verification", correlationId);
13840
13973
  return createFlowMFARequiredResultV2({
13841
13974
  correlationId,
13842
13975
  continuationState: {
13976
+ ...continuationState,
13843
13977
  continuationToken: verifyResult.continuationToken,
13844
- scenario: continuationState.scenario,
13845
- scopes: continuationState.scopes,
13846
13978
  links: {},
13847
13979
  },
13848
13980
  methods: verifyResult.methods.map((method) => ({
@@ -13856,37 +13988,41 @@
13856
13988
  if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13857
13989
  return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
13858
13990
  }
13859
- const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
13991
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for authentication.`;
13860
13992
  this.logger.error(message, correlationId);
13861
13993
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13862
13994
  }
13863
- handleSignUpVerification(continuationState, verifyResult, correlationId) {
13995
+ async handleSignUpVerification(continuationState, verifyResult, correlationId) {
13864
13996
  if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
13865
- const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
13866
- attribute.required === true);
13997
+ const requestedAttributes = verifyResult.attributes;
13998
+ const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
13867
13999
  const nextContinuationState = {
14000
+ ...continuationState,
13868
14001
  continuationToken: verifyResult.continuationToken,
13869
- scenario: continuationState.scenario,
13870
- scopes: continuationState.scopes,
13871
14002
  links: {
13872
14003
  submitAttributes: verifyResult.submitAttributesHref,
13873
14004
  },
13874
- signUp: continuationState.signUp,
13875
14005
  };
13876
- const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
13877
- if (requiredPasswordAttribute &&
13878
- continuationState.signUp?.passwordWasSupplied !== true) {
14006
+ const pendingProfileAttributes = continuationState.signUp?.pendingProfileAttributes;
14007
+ if (pendingProfileAttributes &&
14008
+ Object.keys(pendingProfileAttributes).length > 0) {
14009
+ return this.submitSignUpAttributes({
14010
+ correlationId,
14011
+ continuationState: nextContinuationState,
14012
+ attributes: pendingProfileAttributes,
14013
+ });
14014
+ }
14015
+ if (requestedPasswordAttribute) {
13879
14016
  return createFlowSignUpPasswordRequiredResultV2({
13880
14017
  correlationId,
13881
14018
  continuationState: nextContinuationState,
13882
- attributes,
13883
- requiredPasswordAttribute,
14019
+ requestedPasswordAttribute,
13884
14020
  });
13885
14021
  }
13886
14022
  return createFlowAttributesRequiredResultV2({
13887
14023
  correlationId,
13888
14024
  continuationState: nextContinuationState,
13889
- attributes,
14025
+ attributes: requestedAttributes,
13890
14026
  });
13891
14027
  }
13892
14028
  if (verifyResult.nextAction === ENROLL_RELATION) {
@@ -13904,9 +14040,8 @@
13904
14040
  return createFlowSignInContinuationRequiredResultV2({
13905
14041
  correlationId,
13906
14042
  continuationState: {
14043
+ ...continuationState,
13907
14044
  continuationToken: verifyResult.continuationToken,
13908
- scenario: continuationState.scenario,
13909
- scopes: continuationState.scopes,
13910
14045
  links: {},
13911
14046
  },
13912
14047
  });
@@ -14002,26 +14137,8 @@
14002
14137
  codeLength: result.codeLength,
14003
14138
  });
14004
14139
  }
14005
- toSignUpActionResult(result, continuationState, correlationId) {
14140
+ toSignUpSubmitAttributesResult(result, continuationState, correlationId) {
14006
14141
  const nextAction = result.nextAction;
14007
- if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
14008
- return createFlowCodeRequiredResultV2({
14009
- correlationId,
14010
- continuationState: {
14011
- continuationToken: result.continuationToken,
14012
- scenario: continuationState.scenario,
14013
- scopes: continuationState.scopes,
14014
- links: {
14015
- verify: result.verifyHref,
14016
- resend: result.resendHref,
14017
- },
14018
- signUp: continuationState.signUp,
14019
- },
14020
- channel: result.type,
14021
- sentTo: result.hint,
14022
- codeLength: result.codeLength,
14023
- });
14024
- }
14025
14142
  if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
14026
14143
  return this.createAuthMethodRegistrationRequiredResult({
14027
14144
  correlationId,
@@ -14035,40 +14152,35 @@
14035
14152
  }
14036
14153
  if (result.nextAction ===
14037
14154
  SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
14038
- const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
14039
- attribute.required === true);
14155
+ const requestedAttributes = result.attributes;
14156
+ this.ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId);
14040
14157
  const nextContinuationState = {
14158
+ ...continuationState,
14041
14159
  continuationToken: result.continuationToken,
14042
- scenario: continuationState.scenario,
14043
- scopes: continuationState.scopes,
14044
14160
  links: {
14045
14161
  submitAttributes: result.submitAttributesHref,
14046
14162
  },
14047
- signUp: continuationState.signUp,
14048
14163
  };
14049
- const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
14050
- if (requiredPasswordAttribute &&
14051
- continuationState.signUp?.passwordWasSupplied !== true) {
14164
+ const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
14165
+ if (requestedPasswordAttribute) {
14052
14166
  return createFlowSignUpPasswordRequiredResultV2({
14053
14167
  correlationId,
14054
14168
  continuationState: nextContinuationState,
14055
- attributes,
14056
- requiredPasswordAttribute,
14169
+ requestedPasswordAttribute,
14057
14170
  });
14058
14171
  }
14059
14172
  return createFlowAttributesRequiredResultV2({
14060
14173
  correlationId,
14061
14174
  continuationState: nextContinuationState,
14062
- attributes,
14175
+ attributes: requestedAttributes,
14063
14176
  });
14064
14177
  }
14065
14178
  if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
14066
14179
  return createFlowSignInContinuationRequiredResultV2({
14067
14180
  correlationId,
14068
14181
  continuationState: {
14182
+ ...continuationState,
14069
14183
  continuationToken: result.continuationToken,
14070
- scenario: continuationState.scenario,
14071
- scopes: continuationState.scopes,
14072
14184
  links: {},
14073
14185
  },
14074
14186
  });
@@ -14077,6 +14189,20 @@
14077
14189
  this.logger.error(message, correlationId);
14078
14190
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14079
14191
  }
14192
+ ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId) {
14193
+ const submittedAttributeIds = continuationState.signUp?.submittedAttributeIds ?? [];
14194
+ const hasSubmittedPassword = submittedAttributeIds.some((attributeId) => attributeId.toLowerCase() === "password");
14195
+ const invalidAttribute = requestedAttributes.find((requestedAttribute) => requestedAttribute.attributeId.toLowerCase() === "password"
14196
+ ? hasSubmittedPassword
14197
+ : submittedAttributeIds.includes(requestedAttribute.attributeId));
14198
+ if (invalidAttribute) {
14199
+ const message = invalidAttribute.attributeId.toLowerCase() === "password"
14200
+ ? "The sign-up API cannot request password collection after attribute submission."
14201
+ : "The sign-up API requested an attribute that was already successfully submitted.";
14202
+ this.logger.error(message, correlationId);
14203
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14204
+ }
14205
+ }
14080
14206
  ensureAuthenticationFactor(authenticationFactor, expectedFactor, transition, correlationId) {
14081
14207
  if (authenticationFactor === expectedFactor) {
14082
14208
  return;
@@ -14085,10 +14211,33 @@
14085
14211
  this.logger.error(message, correlationId);
14086
14212
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14087
14213
  }
14214
+ toExistingAccountChallengeResult(challengeResult, method, correlationId) {
14215
+ if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
14216
+ challengeResult.channel?.toLowerCase() ===
14217
+ AuthenticationMethodTypeV2.EMAIL) {
14218
+ return createFlowExistingAccountCodeRequiredResultV2({
14219
+ correlationId,
14220
+ continuationState: challengeResult.continuationState,
14221
+ method,
14222
+ channel: challengeResult.channel,
14223
+ sentTo: challengeResult.sentTo,
14224
+ codeLength: challengeResult.codeLength,
14225
+ });
14226
+ }
14227
+ if (challengeResult.type === FLOW_PASSWORD_REQUIRED_V2) {
14228
+ return createFlowExistingAccountPasswordRequiredResultV2({
14229
+ correlationId,
14230
+ continuationState: challengeResult.continuationState,
14231
+ });
14232
+ }
14233
+ const message = "Existing-account sign-up requires an email code challenge or a password challenge.";
14234
+ this.logger.error(message, correlationId);
14235
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
14236
+ }
14088
14237
  async verifySignInPassword(parameters) {
14089
14238
  const { continuationState, correlationId } = parameters;
14090
14239
  const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitPassword", correlationId), correlationId);
14091
- this.logger.verbose("Submitting V2 sign-in password.", correlationId);
14240
+ this.logger.verbose("Submitting V2 authentication password.", correlationId);
14092
14241
  return this.apiClient.verifyChallenge(this.requireLink(correlationId, continuationState.links.verify), {
14093
14242
  continuationToken: continuationState.continuationToken,
14094
14243
  password: parameters.password,
@@ -14098,9 +14247,8 @@
14098
14247
  return this.signInWithContinuation({
14099
14248
  correlationId,
14100
14249
  continuationState: {
14250
+ ...continuationState,
14101
14251
  continuationToken,
14102
- scenario: continuationState.scenario,
14103
- scopes: continuationState.scopes,
14104
14252
  links: {},
14105
14253
  },
14106
14254
  });
@@ -14129,18 +14277,14 @@
14129
14277
  }
14130
14278
  createChallengeContinuationState(continuationState, challengeResult) {
14131
14279
  return {
14280
+ ...continuationState,
14132
14281
  continuationToken: challengeResult.continuationToken,
14133
- scenario: continuationState.scenario,
14134
- scopes: continuationState.scopes,
14135
14282
  links: {
14136
14283
  challenge: continuationState.links.challenge,
14137
14284
  verify: challengeResult.verifyHref,
14138
14285
  resend: challengeResult.resendHref ??
14139
14286
  continuationState.links.resend,
14140
14287
  },
14141
- ...(continuationState.signUp && {
14142
- signUp: continuationState.signUp,
14143
- }),
14144
14288
  };
14145
14289
  }
14146
14290
  resolveStepApiId(scenario, step, correlationId, authenticationFactor) {
@@ -14170,8 +14314,7 @@
14170
14314
  */
14171
14315
  /**
14172
14316
  * Terminal state indicating the operation failed.
14173
- *
14174
- * The error is carried by the result's `error` payload, not by this state.
14317
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14175
14318
  */
14176
14319
  class FailedStateV2 extends AuthFlowStateBase {
14177
14320
  constructor() {
@@ -14184,8 +14327,14 @@
14184
14327
  * Copyright (c) Microsoft Corporation. All rights reserved.
14185
14328
  * Licensed under the MIT License.
14186
14329
  */
14330
+ const ATTRIBUTE_VALIDATION_ERROR = "attributeValidationError";
14187
14331
  const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
14188
14332
  const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
14333
+ const PASSWORD_BANNED = "passwordBanned";
14334
+ const PASSWORD_IS_INVALID = "passwordIsInvalid";
14335
+ const PASSWORD_RECENTLY_USED = "passwordRecentlyUsed";
14336
+ const PASSWORD_TOO_LONG = "passwordTooLong";
14337
+ const PASSWORD_TOO_SHORT = "passwordTooShort";
14189
14338
  const PASSWORD_TOO_WEAK = "passwordTooWeak";
14190
14339
  const USER_NOT_FOUND = "userNotFound";
14191
14340
 
@@ -14194,12 +14343,13 @@
14194
14343
  * Licensed under the MIT License.
14195
14344
  */
14196
14345
  /**
14197
- * Error returned by a native authentication V2 operation. Use its classifiers
14198
- * to handle known failures while retaining raw diagnostics through `errorData`.
14346
+ * Error returned by a native authentication V2 operation.
14347
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14199
14348
  */
14200
14349
  class AuthFlowErrorV2 {
14201
- constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
14350
+ constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown, errorContext = "default") {
14202
14351
  this.errorData = errorData;
14352
+ this.errorContext = errorContext;
14203
14353
  this.scenario = scenario;
14204
14354
  }
14205
14355
  get correlationId() {
@@ -14216,123 +14366,111 @@
14216
14366
  ? this.errorData.innerErrorCode
14217
14367
  : undefined;
14218
14368
  }
14219
- /**
14220
- * Gets the attribute ids that the service reports as required.
14221
- */
14222
14369
  get requiredAttributes() {
14223
14370
  return this.getAttributeIdsByCode("attributeRequired");
14224
14371
  }
14225
- /**
14226
- * Gets the attribute ids whose submitted values failed validation.
14227
- */
14228
14372
  get invalidAttributes() {
14229
14373
  return this.getAttributeIdsByCode("attributeValidationFailed");
14230
14374
  }
14231
14375
  /**
14232
- * Checks if the error requires the flow to continue in the browser. The
14233
- * server surfaces this as the `web_redirect_required` OAuth suberror, so a
14234
- * browser hand-off arrives as a `FailedStateV2` on which this detector
14235
- * returns true.
14376
+ * Checks whether the flow must continue in the browser.
14236
14377
  * @returns True if the browser is required, false otherwise.
14237
14378
  */
14238
14379
  isBrowserRequired() {
14239
- return this.errorData.subError === WEB_REDIRECT_REQUIRED;
14380
+ return (this.errorData.error === "invalid_grant" &&
14381
+ this.errorData.subError === WEB_REDIRECT_REQUIRED);
14240
14382
  }
14241
14383
  /**
14242
- * Checks if the error is due to a caller-supplied argument failing
14243
- * client-side validation before the request was issued (for example an empty
14244
- * username, code, or password, or an unknown method id). Use it to prompt the
14245
- * user to correct the input rather than treating it as a server failure.
14384
+ * Checks whether a caller-supplied argument failed client-side validation.
14246
14385
  * @returns True if the input was invalid, false otherwise.
14247
14386
  */
14248
14387
  isInvalidInput() {
14249
14388
  return this.errorData instanceof InvalidArgumentError;
14250
14389
  }
14251
14390
  /**
14252
- * Checks whether the service rejected the username parameter. Use it to ask
14253
- * the user to correct the supplied username.
14254
- * @returns True when the username is invalid, otherwise false.
14391
+ * Checks whether the supplied username failed local validation.
14392
+ * @returns True when local username validation failed.
14255
14393
  */
14256
14394
  isInvalidUsername() {
14257
- return this.isUserInvalidError();
14395
+ return (this.errorData instanceof InvalidArgumentError &&
14396
+ this.errorData.argName === "inputs.username");
14258
14397
  }
14259
14398
  /**
14260
- * Checks whether the supplied username does not identify an account. Use it
14261
- * to distinguish a missing account from other request failures.
14399
+ * Checks whether the supplied username does not identify an account.
14262
14400
  * @returns True when the service reports that the user was not found.
14263
14401
  */
14264
14402
  isUserNotFound() {
14265
14403
  return this.isUserNotFoundError();
14266
14404
  }
14267
14405
  /**
14268
- * Checks whether the service rejected the supplied sign-in credentials. This
14269
- * classifier does not identify new-password policy failures.
14270
- * @returns True when the username or password is incorrect.
14271
- */
14272
- isInvalidCredentials() {
14273
- return this.isPasswordIncorrectError();
14274
- }
14275
- /**
14276
- * Checks whether the service rejected a one-time code. Use it to prompt the
14277
- * user to re-enter the code or request a new one.
14406
+ * Checks whether the service rejected a one-time code.
14278
14407
  * @returns True when the one-time code is invalid, otherwise false.
14279
14408
  */
14280
14409
  isInvalidCode() {
14281
- return this.isInvalidCodeError();
14410
+ return this.errorContext === "default" && this.isInvalidCodeError();
14282
14411
  }
14283
14412
  /**
14284
- * Checks whether a new password violates password policy. It recognizes
14285
- * both weak-password responses and password-targeted validation details.
14286
- * @returns True when the new password is invalid, otherwise false.
14413
+ * Checks whether the service rejected an MFA or registration challenge.
14414
+ * @returns True when the verification challenge is invalid.
14287
14415
  */
14288
- isInvalidPassword() {
14289
- return (this.isInvalidPasswordError() ||
14290
- this.isPasswordPolicyViolationError());
14416
+ isInvalidChallenge() {
14417
+ return ((this.errorContext === "mfaVerification" ||
14418
+ this.errorContext === "authMethodRegistration") &&
14419
+ this.isInvalidCodeError());
14291
14420
  }
14292
14421
  /**
14293
- * Checks whether an account already exists for the supplied identifier.
14294
- * This can occur at different stages while completing sign-up.
14295
- * @returns True if the account already exists, otherwise false.
14422
+ * Checks whether the service rejected non-password attributes.
14423
+ * Password-targeted validation is reported only by isInvalidPassword().
14424
+ * @returns True when at least one non-password attribute is invalid.
14296
14425
  */
14297
- isUserAlreadyExists() {
14298
- return this.getAttributeValidationDetails().some((detail) => detail.code === "userAlreadyExists");
14426
+ isInvalidAttributes() {
14427
+ if (!this.isAttributeValidationError() ||
14428
+ this.isPasswordAttributeValidationError()) {
14429
+ return false;
14430
+ }
14431
+ const attributeIds = this.getAttributeValidationDetails()
14432
+ .flatMap((detail) => Array.isArray(detail.attributeIds) ? detail.attributeIds : [])
14433
+ .filter((attributeId) => typeof attributeId === "string");
14434
+ return attributeIds.some((attributeId) => attributeId.length > 0);
14299
14435
  }
14300
14436
  /**
14301
- * Checks whether the service requires attributes omitted from the request.
14302
- * Use it to collect the required attributes before resubmitting.
14303
- * @returns True when required attributes are missing, otherwise false.
14437
+ * Checks whether the service rejected a supplied password.
14438
+ * @returns True when the supplied password is invalid, otherwise false.
14304
14439
  */
14305
- isMissingRequiredAttributes() {
14306
- return this.requiredAttributes.length > 0;
14440
+ isInvalidPassword() {
14441
+ return (this.isPasswordIncorrectError() ||
14442
+ this.isInvalidPasswordError() ||
14443
+ this.isPasswordAttributeValidationError());
14307
14444
  }
14308
- isUserNotFoundError() {
14445
+ isAttributeValidationError() {
14309
14446
  return (this.errorData.error === "invalidRequest" &&
14310
- (this.innerErrorCode === USER_NOT_FOUND ||
14311
- this.errorData.errorDescription?.includes("AADSTS50034") ===
14312
- true));
14447
+ this.innerErrorCode === ATTRIBUTE_VALIDATION_ERROR);
14313
14448
  }
14314
- isUserInvalidError() {
14449
+ isUserNotFoundError() {
14315
14450
  return (this.errorData.error === "invalidRequest" &&
14316
- this.errorData.errorDescription?.includes("AADSTS90100") === true &&
14317
- this.errorData.errorDescription
14318
- .toLowerCase()
14319
- .includes("username parameter"));
14451
+ this.innerErrorCode === USER_NOT_FOUND);
14320
14452
  }
14321
14453
  isInvalidCodeError() {
14322
14454
  return (this.errorData.error === "invalidGrant" &&
14323
14455
  this.innerErrorCode === INVALID_ONE_TIME_CODE);
14324
14456
  }
14325
14457
  isInvalidPasswordError() {
14458
+ const innerErrorCode = this.innerErrorCode;
14326
14459
  return (this.errorData.error === "invalidRequest" &&
14327
- this.innerErrorCode === PASSWORD_TOO_WEAK);
14328
- }
14329
- isPasswordPolicyViolationError() {
14460
+ (innerErrorCode === PASSWORD_TOO_WEAK ||
14461
+ innerErrorCode === PASSWORD_TOO_SHORT ||
14462
+ innerErrorCode === PASSWORD_TOO_LONG ||
14463
+ innerErrorCode === PASSWORD_IS_INVALID ||
14464
+ innerErrorCode === PASSWORD_RECENTLY_USED ||
14465
+ innerErrorCode === PASSWORD_BANNED));
14466
+ }
14467
+ isPasswordAttributeValidationError() {
14468
+ if (!this.isAttributeValidationError()) {
14469
+ return false;
14470
+ }
14330
14471
  return this.getAttributeValidationDetails().some((detail) => {
14331
14472
  const attributeIds = detail.attributeIds;
14332
- return (detail.code === "passwordPolicyViolation" &&
14333
- Array.isArray(attributeIds) &&
14334
- attributeIds.some((attributeId) => typeof attributeId === "string" &&
14335
- attributeId.toLowerCase() === "password"));
14473
+ return (Array.isArray(attributeIds) && attributeIds.includes("password"));
14336
14474
  });
14337
14475
  }
14338
14476
  isPasswordIncorrectError() {
@@ -14358,8 +14496,8 @@
14358
14496
  * Licensed under the MIT License.
14359
14497
  */
14360
14498
  /**
14361
- * Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
14362
- * to narrow the state before accessing its members.
14499
+ * Result of a native auth V2 operation.
14500
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14363
14501
  */
14364
14502
  class CustomAuthResultV2 {
14365
14503
  constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
@@ -14368,8 +14506,7 @@
14368
14506
  this.scenario = scenario;
14369
14507
  }
14370
14508
  /**
14371
- * Narrows the result to a specific state by its `stateType` discriminator.
14372
- * A successful match makes the state's properties available without a cast.
14509
+ * Checks whether the result matches a state type and narrows its state.
14373
14510
  * @param stateType - The state type to test for.
14374
14511
  * @returns True (and narrows `state`) when the current state matches `stateType`.
14375
14512
  */
@@ -14377,25 +14514,32 @@
14377
14514
  return this.state.stateType === stateType;
14378
14515
  }
14379
14516
  /**
14380
- * Checks whether the result is in the terminal failed state. A failed result
14381
- * contains the unified V2 flow error.
14517
+ * Checks whether the operation failed.
14382
14518
  * @returns True (and narrows `state`) when the operation failed.
14383
14519
  */
14384
14520
  isFailed() {
14385
14521
  return this.state.stateType === "failed";
14386
14522
  }
14387
14523
  /**
14388
- * Creates a failed result from the supplied error. The result uses the
14389
- * shared {@link FailedStateV2} terminal state and unified V2 flow error.
14524
+ * Checks whether the current state requires a password.
14525
+ * @returns True (and narrows `state`) when a password is required.
14526
+ */
14527
+ isPasswordRequired() {
14528
+ return this.state.stateType === "passwordRequired";
14529
+ }
14530
+ /**
14531
+ * Creates a failed result from the supplied error.
14532
+ * Optional error context identifies MFA verification or authentication-method registration.
14390
14533
  * @param error - The error that occurred.
14391
14534
  * @param options - The flow-error context.
14392
14535
  * @returns A failed result carrying the unified V2 flow error.
14393
14536
  */
14394
14537
  static createWithError(error, options) {
14395
- const { scenario = CustomAuthFlowScenarioV2.Unknown, correlationId } = options;
14396
- const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
14397
- const flowError = new AuthFlowErrorV2(errorData, scenario);
14398
- const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
14538
+ const { correlationId } = options;
14539
+ const flowError = error instanceof AuthFlowErrorV2
14540
+ ? error
14541
+ : new AuthFlowErrorV2(CustomAuthResultV2.createErrorData(error, correlationId), options.scenario ?? CustomAuthFlowScenarioV2.Unknown, options.errorContext);
14542
+ const result = new CustomAuthResultV2(new FailedStateV2(), undefined, flowError.scenario);
14399
14543
  result.error = flowError;
14400
14544
  return result;
14401
14545
  }
@@ -14428,9 +14572,7 @@
14428
14572
  */
14429
14573
  /**
14430
14574
  * Terminal state indicating the operation completed successfully.
14431
- *
14432
- * Completion data (for example the signed-in account) is carried by the
14433
- * result's `data` payload, not by this state.
14575
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14434
14576
  */
14435
14577
  class CompletedStateV2 extends AuthFlowStateBase {
14436
14578
  constructor() {
@@ -14444,21 +14586,90 @@
14444
14586
  * Licensed under the MIT License.
14445
14587
  */
14446
14588
  /**
14447
- * State returned when a newly registered authentication method must be
14448
- * activated with the challenge sent by the service.
14589
+ * State returned when a completed V2 flow can sign the user in.
14590
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14449
14591
  */
14450
- class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14451
- constructor(stateParameters) {
14452
- super(stateParameters);
14453
- this.stateType = "authMethodVerificationRequired";
14454
- this.type = stateParameters.type;
14455
- this.sentTo = stateParameters.sentTo;
14456
- this.codeLength = stateParameters.codeLength;
14592
+ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
14593
+ constructor() {
14594
+ super(...arguments);
14595
+ this.stateType = "signInContinuation";
14457
14596
  }
14458
14597
  /**
14459
- * Submits the activation challenge for the registered method.
14460
- * @param challenge - The activation challenge to submit.
14461
- * @returns The completed authentication result or a failed state.
14598
+ * Signs the user in after completing the V2 flow.
14599
+ * @returns The result of completing the continuation sign-in.
14600
+ */
14601
+ async signIn() {
14602
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14603
+ try {
14604
+ logger.verbose("Signing in with a V2 continuation.", correlationId);
14605
+ const result = await flowClient.signInWithContinuation({
14606
+ correlationId,
14607
+ continuationState,
14608
+ });
14609
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14610
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14611
+ }
14612
+ catch (error) {
14613
+ logger.errorPii(`Failed to sign in with a V2 continuation. Error: '${error}'.`, correlationId);
14614
+ return CustomAuthResultV2.createWithError(error, {
14615
+ scenario: continuationState.scenario,
14616
+ correlationId,
14617
+ });
14618
+ }
14619
+ }
14620
+ }
14621
+
14622
+ /*
14623
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14624
+ * Licensed under the MIT License.
14625
+ */
14626
+ class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
14627
+ constructor(stateParameters) {
14628
+ super(stateParameters);
14629
+ this.method = stateParameters.method;
14630
+ this.sentTo = stateParameters.sentTo;
14631
+ this.channel = stateParameters.channel;
14632
+ this.codeLength = stateParameters.codeLength;
14633
+ }
14634
+ async submitCodeCore(code, authenticationFactor) {
14635
+ ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
14636
+ return this.stateParameters.flowClient.submitCode({
14637
+ correlationId: this.stateParameters.correlationId,
14638
+ continuationState: this.stateParameters.continuationState,
14639
+ authenticationFactor,
14640
+ code,
14641
+ });
14642
+ }
14643
+ async resendCodeCore(authenticationFactor) {
14644
+ return this.stateParameters.flowClient.resendCode({
14645
+ correlationId: this.stateParameters.correlationId,
14646
+ continuationState: this.stateParameters.continuationState,
14647
+ authenticationFactor,
14648
+ });
14649
+ }
14650
+ }
14651
+
14652
+ /*
14653
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14654
+ * Licensed under the MIT License.
14655
+ */
14656
+ /**
14657
+ * State returned when a newly registered authentication method must be
14658
+ * activated with the challenge sent by the service.
14659
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14660
+ */
14661
+ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14662
+ constructor(stateParameters) {
14663
+ super(stateParameters);
14664
+ this.stateType = "authMethodVerificationRequired";
14665
+ this.type = stateParameters.type;
14666
+ this.sentTo = stateParameters.sentTo;
14667
+ this.codeLength = stateParameters.codeLength;
14668
+ }
14669
+ /**
14670
+ * Submits the activation challenge for the registered method.
14671
+ * @param challenge - The activation challenge to submit.
14672
+ * @returns A sign-in continuation, completed authentication result, or failed state.
14462
14673
  */
14463
14674
  async submitChallenge(challenge) {
14464
14675
  const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
@@ -14470,6 +14681,16 @@
14470
14681
  continuationState,
14471
14682
  code: challenge,
14472
14683
  });
14684
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14685
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
14686
+ correlationId: result.correlationId,
14687
+ logger,
14688
+ config: this.stateParameters.config,
14689
+ flowClient,
14690
+ continuationState: result.continuationState,
14691
+ cacheClient: this.stateParameters.cacheClient,
14692
+ }), undefined, result.continuationState.scenario);
14693
+ }
14473
14694
  const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14474
14695
  return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14475
14696
  }
@@ -14478,12 +14699,12 @@
14478
14699
  return CustomAuthResultV2.createWithError(error, {
14479
14700
  scenario: continuationState.scenario,
14480
14701
  correlationId,
14702
+ errorContext: "authMethodRegistration",
14481
14703
  });
14482
14704
  }
14483
14705
  }
14484
14706
  /**
14485
- * Requests a replacement activation challenge using the retained server
14486
- * resend link.
14707
+ * Requests a replacement activation challenge for the registered method.
14487
14708
  * @returns Refreshed activation metadata or a failed state.
14488
14709
  */
14489
14710
  async resendChallenge() {
@@ -14521,8 +14742,8 @@
14521
14742
  * Licensed under the MIT License.
14522
14743
  */
14523
14744
  /**
14524
- * State returned when an authentication method must be registered. Applications
14525
- * select one of the sanitized offered methods and provide its contact value.
14745
+ * State returned when an authentication method must be registered.
14746
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14526
14747
  */
14527
14748
  class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14528
14749
  constructor(stateParameters) {
@@ -14579,143 +14800,8 @@
14579
14800
  * Licensed under the MIT License.
14580
14801
  */
14581
14802
  /**
14582
- * Shared state returned when a completed V2 flow can sign the user in by
14583
- * redeeming its continuation. Password reset and sign-up can both surface this
14584
- * state without duplicating the token-acquisition behavior.
14585
- */
14586
- class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
14587
- constructor() {
14588
- super(...arguments);
14589
- this.stateType = "signInContinuation";
14590
- }
14591
- /**
14592
- * Signs the user in using the continuation established by the completed V2
14593
- * flow. The result either reaches the completed state with the signed-in
14594
- * account data or reports why the follow-up sign-in could not complete.
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("Signing in with a V2 continuation.", 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(`Failed to sign in with a V2 continuation. Error: '${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
- /**
14623
- * State returned when the user must supply a new password to complete the flow.
14624
- * A successful submission can require registration or return a continuation
14625
- * for sign-in.
14626
- */
14627
- class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14628
- constructor() {
14629
- super(...arguments);
14630
- this.stateType = "newPasswordRequired";
14631
- }
14632
- /**
14633
- * Submits the new password to complete the reset. Enrollment may be
14634
- * required before sign-in; a rejected password returns an error.
14635
- * @param password - The new password to set.
14636
- * @returns The result of submitting the new password.
14637
- */
14638
- async submitNewPassword(password) {
14639
- const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
14640
- try {
14641
- this.ensurePasswordIsNotEmpty(password);
14642
- logger.verbose("Submitting V2 new password.", correlationId);
14643
- const result = await flowClient.submitNewPassword({
14644
- correlationId,
14645
- continuationState,
14646
- newPassword: password,
14647
- });
14648
- const resultType = result.type;
14649
- if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
14650
- return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
14651
- correlationId: result.correlationId,
14652
- logger,
14653
- config: this.stateParameters.config,
14654
- flowClient,
14655
- continuationState: result.continuationState,
14656
- cacheClient: this.stateParameters.cacheClient,
14657
- methods: result.methods,
14658
- }), undefined, result.continuationState.scenario);
14659
- }
14660
- if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14661
- return new CustomAuthResultV2(new SignInContinuationStateV2({
14662
- correlationId: result.correlationId,
14663
- logger,
14664
- config: this.stateParameters.config,
14665
- flowClient,
14666
- continuationState: result.continuationState,
14667
- cacheClient: this.stateParameters.cacheClient,
14668
- }), undefined, result.continuationState.scenario);
14669
- }
14670
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
14671
- }
14672
- catch (error) {
14673
- logger.errorPii(`Failed to submit V2 new password. Error: '${error}'.`, correlationId);
14674
- return CustomAuthResultV2.createWithError(error, {
14675
- scenario: continuationState.scenario,
14676
- correlationId,
14677
- });
14678
- }
14679
- }
14680
- }
14681
-
14682
- /*
14683
- * Copyright (c) Microsoft Corporation. All rights reserved.
14684
- * Licensed under the MIT License.
14685
- */
14686
- class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
14687
- constructor(stateParameters) {
14688
- super(stateParameters);
14689
- this.method = stateParameters.method;
14690
- this.sentTo = stateParameters.sentTo;
14691
- this.channel = stateParameters.channel;
14692
- this.codeLength = stateParameters.codeLength;
14693
- }
14694
- async submitCodeCore(code, authenticationFactor) {
14695
- ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
14696
- return this.stateParameters.flowClient.submitCode({
14697
- correlationId: this.stateParameters.correlationId,
14698
- continuationState: this.stateParameters.continuationState,
14699
- authenticationFactor,
14700
- code,
14701
- });
14702
- }
14703
- async resendCodeCore(authenticationFactor) {
14704
- return this.stateParameters.flowClient.resendCode({
14705
- correlationId: this.stateParameters.correlationId,
14706
- continuationState: this.stateParameters.continuationState,
14707
- authenticationFactor,
14708
- });
14709
- }
14710
- }
14711
-
14712
- /*
14713
- * Copyright (c) Microsoft Corporation. All rights reserved.
14714
- * Licensed under the MIT License.
14715
- */
14716
- /**
14717
- * State returned when first-factor email authentication requires a one-time
14718
- * code. It allows the app to submit the code or request a replacement.
14803
+ * State returned when first-factor authentication requires a one-time code.
14804
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14719
14805
  */
14720
14806
  class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14721
14807
  constructor() {
@@ -14723,8 +14809,7 @@
14723
14809
  this.stateType = "codeRequired";
14724
14810
  }
14725
14811
  /**
14726
- * Submits the first-factor email code and advances the active flow. The
14727
- * result may complete the operation or require another flow-specific step.
14812
+ * Submits the first-factor code.
14728
14813
  * @param code - The code to submit.
14729
14814
  * @returns The result of submitting the first-factor code.
14730
14815
  */
@@ -14735,14 +14820,11 @@
14735
14820
  const result = await this.submitCodeCore(code);
14736
14821
  const resultType = result.type;
14737
14822
  if (result.type === FLOW_NEW_PASSWORD_REQUIRED_V2) {
14738
- return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
14739
- correlationId: result.correlationId,
14740
- logger,
14741
- config: this.stateParameters.config,
14742
- flowClient: this.stateParameters.flowClient,
14743
- continuationState: result.continuationState,
14744
- cacheClient: this.stateParameters.cacheClient,
14745
- }), undefined, result.continuationState.scenario);
14823
+ const resetPasswordStateTransitionHandler = this.stateParameters.resetPasswordStateTransitionHandler;
14824
+ if (!resetPasswordStateTransitionHandler) {
14825
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Password-reset state transition handler is missing.", correlationId);
14826
+ }
14827
+ return resetPasswordStateTransitionHandler.handleNewPasswordRequired(result, this.stateParameters);
14746
14828
  }
14747
14829
  if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2 ||
14748
14830
  result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
@@ -14750,10 +14832,10 @@
14750
14832
  if (!signUpStateTransitionHandler) {
14751
14833
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-up state transition handler is missing.", correlationId);
14752
14834
  }
14753
- return signUpStateTransitionHandler.handleVerification(result, {
14835
+ return signUpStateTransitionHandler.handleAttributeSubmission(result, {
14754
14836
  ...this.stateParameters,
14755
14837
  signUpStateTransitionHandler,
14756
- });
14838
+ }, "attribute");
14757
14839
  }
14758
14840
  if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14759
14841
  return new CustomAuthResultV2(new SignInContinuationStateV2({
@@ -14798,8 +14880,7 @@
14798
14880
  }
14799
14881
  }
14800
14882
  /**
14801
- * Requests a replacement first-factor email code. The returned state
14802
- * contains the refreshed challenge metadata.
14883
+ * Requests a replacement first-factor code.
14803
14884
  * @returns The result of requesting a replacement code.
14804
14885
  */
14805
14886
  async resendCode() {
@@ -14816,6 +14897,8 @@
14816
14897
  cacheClient: this.stateParameters.cacheClient,
14817
14898
  signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
14818
14899
  signInStateTransitionHandler: this.stateParameters.signInStateTransitionHandler,
14900
+ resetPasswordStateTransitionHandler: this.stateParameters
14901
+ .resetPasswordStateTransitionHandler,
14819
14902
  method: this.method,
14820
14903
  sentTo: result.sentTo,
14821
14904
  channel: result.channel,
@@ -14837,8 +14920,9 @@
14837
14920
  * Licensed under the MIT License.
14838
14921
  */
14839
14922
  /**
14840
- * State returned when sign-in requires verification of an email or SMS MFA
14923
+ * State returned when authentication requires verification of an email or SMS MFA
14841
14924
  * challenge. It allows the app to submit the challenge or request a replacement.
14925
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14842
14926
  */
14843
14927
  class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14844
14928
  constructor() {
@@ -14847,7 +14931,6 @@
14847
14931
  }
14848
14932
  /**
14849
14933
  * Submits the email or SMS challenge as the second authentication factor.
14850
- * Successful verification completes sign-in.
14851
14934
  * @param challenge - The challenge value to submit.
14852
14935
  * @returns The result of submitting the MFA challenge.
14853
14936
  */
@@ -14856,6 +14939,16 @@
14856
14939
  try {
14857
14940
  logger.verbose("Submitting V2 MFA challenge.", correlationId);
14858
14941
  const result = await this.submitCodeCore(challenge, AuthenticationFactorV2.MULTI_FACTOR);
14942
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14943
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
14944
+ correlationId: result.correlationId,
14945
+ logger,
14946
+ config: this.stateParameters.config,
14947
+ flowClient: this.stateParameters.flowClient,
14948
+ continuationState: result.continuationState,
14949
+ cacheClient: this.stateParameters.cacheClient,
14950
+ }), undefined, result.continuationState.scenario);
14951
+ }
14859
14952
  if (result.type !== FLOW_COMPLETED_V2) {
14860
14953
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
14861
14954
  }
@@ -14867,12 +14960,12 @@
14867
14960
  return CustomAuthResultV2.createWithError(error, {
14868
14961
  scenario: continuationState.scenario,
14869
14962
  correlationId,
14963
+ errorContext: "mfaVerification",
14870
14964
  });
14871
14965
  }
14872
14966
  }
14873
14967
  /**
14874
- * Requests a replacement challenge for the selected MFA method. The
14875
- * returned state contains the refreshed email or SMS challenge metadata.
14968
+ * Requests a replacement challenge for the selected MFA method.
14876
14969
  * @returns The result of requesting a replacement MFA challenge.
14877
14970
  */
14878
14971
  async resendChallenge() {
@@ -14903,15 +14996,157 @@
14903
14996
  }
14904
14997
  }
14905
14998
 
14999
+ /*
15000
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15001
+ * Licensed under the MIT License.
15002
+ */
15003
+ function handleExistingAccountVerificationResultV2(result, stateParameters) {
15004
+ const commonStateParameters = {
15005
+ correlationId: result.correlationId,
15006
+ logger: stateParameters.logger,
15007
+ config: stateParameters.config,
15008
+ flowClient: stateParameters.flowClient,
15009
+ continuationState: "continuationState" in result
15010
+ ? result.continuationState
15011
+ : stateParameters.continuationState,
15012
+ cacheClient: stateParameters.cacheClient,
15013
+ };
15014
+ if (result.type === FLOW_COMPLETED_V2) {
15015
+ const account = new CustomAuthAccountData(result.authenticationResult.account, stateParameters.config, stateParameters.cacheClient, stateParameters.logger, result.correlationId);
15016
+ return new CustomAuthResultV2(new CompletedStateV2(), account, stateParameters.continuationState.scenario);
15017
+ }
15018
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15019
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15020
+ ...commonStateParameters,
15021
+ continuationState: result.continuationState,
15022
+ methods: result.methods,
15023
+ }), undefined, result.continuationState.scenario);
15024
+ }
15025
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
15026
+ const signInStateTransitionHandler = stateParameters.signInStateTransitionHandler;
15027
+ if (!signInStateTransitionHandler) {
15028
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-in state transition handler is missing.", stateParameters.correlationId);
15029
+ }
15030
+ return signInStateTransitionHandler.handleMfaRequired(result, stateParameters);
15031
+ }
15032
+ const resultType = result.type;
15033
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account verification result type '${resultType}' is not supported.`, stateParameters.correlationId);
15034
+ }
15035
+
14906
15036
  /*
14907
15037
  * Copyright (c) Microsoft Corporation. All rights reserved.
14908
15038
  * Licensed under the MIT License.
14909
15039
  */
14910
15040
  /**
14911
- * State returned when the user must select one of several authentication
14912
- * methods before a challenge can be issued. It exposes the list of offered
14913
- * methods and lets the app request a challenge for the chosen one. The flow
14914
- * stays on this state until a challenge is successfully requested.
15041
+ * State returned when sign-up discovers an existing account that requires an
15042
+ * email code. Submitting or resending the code preserves existing-account authentication.
15043
+ */
15044
+ class ExistingAccountCodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
15045
+ constructor() {
15046
+ super(...arguments);
15047
+ this.stateType = "existingAccountCodeRequired";
15048
+ }
15049
+ /**
15050
+ * Submits the existing account's email code and continues authentication.
15051
+ * The result can complete authentication or require enrollment or MFA.
15052
+ * @param code - The email code to verify.
15053
+ * @returns The next existing-account authentication result.
15054
+ */
15055
+ async submitCode(code) {
15056
+ const { correlationId, logger, continuationState } = this.stateParameters;
15057
+ try {
15058
+ const result = await this.submitCodeCore(code);
15059
+ if (result.type === FLOW_COMPLETED_V2 ||
15060
+ result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 ||
15061
+ result.type === FLOW_MFA_REQUIRED_V2) {
15062
+ return handleExistingAccountVerificationResultV2(result, this.stateParameters);
15063
+ }
15064
+ const resultType = result.type;
15065
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account code submission result type '${resultType}' is not supported.`, correlationId);
15066
+ }
15067
+ catch (error) {
15068
+ logger.errorPii(`Failed to submit V2 existing-account code. Error: '${error}'.`, correlationId);
15069
+ return CustomAuthResultV2.createWithError(error, {
15070
+ scenario: continuationState.scenario,
15071
+ correlationId,
15072
+ });
15073
+ }
15074
+ }
15075
+ /**
15076
+ * Requests a replacement email code for the existing account. The returned
15077
+ * state contains the fresh continuation token and challenge metadata.
15078
+ * @returns The refreshed existing-account code state or an error.
15079
+ */
15080
+ async resendCode() {
15081
+ const { correlationId, logger, continuationState } = this.stateParameters;
15082
+ try {
15083
+ const result = await this.resendCodeCore();
15084
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
15085
+ ...this.stateParameters,
15086
+ correlationId: result.correlationId,
15087
+ continuationState: result.continuationState,
15088
+ sentTo: result.sentTo,
15089
+ channel: result.channel,
15090
+ codeLength: result.codeLength,
15091
+ }), undefined, result.continuationState.scenario);
15092
+ }
15093
+ catch (error) {
15094
+ logger.errorPii(`Failed to resend V2 existing-account code. Error: '${error}'.`, correlationId);
15095
+ return CustomAuthResultV2.createWithError(error, {
15096
+ scenario: continuationState.scenario,
15097
+ correlationId,
15098
+ });
15099
+ }
15100
+ }
15101
+ }
15102
+
15103
+ /*
15104
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15105
+ * Licensed under the MIT License.
15106
+ */
15107
+ /**
15108
+ * State returned when sign-up discovers an existing account that requires its
15109
+ * current password. The password is verified as an authentication credential.
15110
+ */
15111
+ class ExistingAccountPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15112
+ constructor() {
15113
+ super(...arguments);
15114
+ this.stateType = "existingAccountPasswordRequired";
15115
+ }
15116
+ /**
15117
+ * Verifies the existing account's current password and continues authentication.
15118
+ * The result can complete authentication or require enrollment or MFA.
15119
+ * @param password - The existing account password.
15120
+ * @returns The next existing-account authentication result.
15121
+ */
15122
+ async submitPassword(password) {
15123
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15124
+ try {
15125
+ this.ensurePasswordIsNotEmpty(password);
15126
+ const result = await flowClient.submitSignInPassword({
15127
+ correlationId,
15128
+ continuationState,
15129
+ password,
15130
+ });
15131
+ return handleExistingAccountVerificationResultV2(result, this.stateParameters);
15132
+ }
15133
+ catch (error) {
15134
+ logger.errorPii(`Failed to submit V2 existing-account password. Error: '${error}'.`, correlationId);
15135
+ return CustomAuthResultV2.createWithError(error, {
15136
+ scenario: continuationState.scenario,
15137
+ correlationId,
15138
+ });
15139
+ }
15140
+ }
15141
+ }
15142
+
15143
+ /*
15144
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15145
+ * Licensed under the MIT License.
15146
+ */
15147
+ /**
15148
+ * State returned when the user must select an authentication method.
15149
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
14915
15150
  */
14916
15151
  class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14917
15152
  constructor(stateParameters) {
@@ -14920,13 +15155,12 @@
14920
15155
  this.methods = stateParameters.methods;
14921
15156
  }
14922
15157
  /**
14923
- * Selects an authentication method and requests its challenge. The returned
14924
- * state identifies the credential the application must collect.
15158
+ * Selects an authentication method and requests its challenge.
14925
15159
  * @param method - The method to select, from {@link methods}.
14926
15160
  * @returns The result of selecting the method and requesting its challenge.
14927
15161
  */
14928
15162
  async selectAuthMethod(method) {
14929
- const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, } = this.stateParameters;
15163
+ const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, resetPasswordStateTransitionHandler, } = this.stateParameters;
14930
15164
  try {
14931
15165
  logger.verbose("Requesting challenge for the selected V2 method.", correlationId);
14932
15166
  const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
@@ -14937,22 +15171,45 @@
14937
15171
  flowClient,
14938
15172
  continuationState: result.continuationState,
14939
15173
  cacheClient: this.stateParameters.cacheClient,
15174
+ signInStateTransitionHandler,
14940
15175
  };
14941
- if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15176
+ const isExistingAccountSignUp = continuationState.scenario ===
15177
+ CustomAuthFlowScenarioV2.SignUp &&
15178
+ continuationState.signUp?.purpose === "existingAccount";
15179
+ const channel = result.type === FLOW_CODE_REQUIRED_V2
15180
+ ? result.channel?.toLowerCase()
15181
+ : undefined;
15182
+ if (isExistingAccountSignUp &&
15183
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
14942
15184
  result.type === FLOW_CODE_REQUIRED_V2 &&
14943
- (result.channel?.toLowerCase() ===
14944
- AuthenticationMethodTypeV2.EMAIL ||
14945
- result.channel?.toLowerCase() ===
14946
- AuthenticationMethodTypeV2.SMS)) {
15185
+ channel === AuthenticationMethodTypeV2.EMAIL) {
15186
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
15187
+ ...commonStateParameters,
15188
+ method: selectedMethod,
15189
+ sentTo: result.sentTo,
15190
+ channel: result.channel,
15191
+ codeLength: result.codeLength,
15192
+ }), undefined, result.continuationState.scenario);
15193
+ }
15194
+ if (!isExistingAccountSignUp &&
15195
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15196
+ result.type === FLOW_CODE_REQUIRED_V2 &&
15197
+ (channel === AuthenticationMethodTypeV2.EMAIL ||
15198
+ channel === AuthenticationMethodTypeV2.SMS)) {
14947
15199
  return new CustomAuthResultV2(new CodeRequiredStateV2({
14948
15200
  ...commonStateParameters,
14949
- signInStateTransitionHandler,
15201
+ resetPasswordStateTransitionHandler,
14950
15202
  method: selectedMethod,
14951
15203
  sentTo: result.sentTo,
14952
15204
  channel: result.channel,
14953
15205
  codeLength: result.codeLength,
14954
15206
  }), undefined, result.continuationState.scenario);
14955
15207
  }
15208
+ if (isExistingAccountSignUp &&
15209
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
15210
+ result.type === FLOW_PASSWORD_REQUIRED_V2) {
15211
+ return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2(commonStateParameters), undefined, result.continuationState.scenario);
15212
+ }
14956
15213
  if (continuationState.scenario ===
14957
15214
  CustomAuthFlowScenarioV2.SignIn &&
14958
15215
  authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
@@ -14972,12 +15229,17 @@
14972
15229
  codeLength: result.codeLength,
14973
15230
  }), undefined, result.continuationState.scenario);
14974
15231
  }
14975
- const expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
15232
+ let expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
14976
15233
  ? continuationState.scenario ===
14977
15234
  CustomAuthFlowScenarioV2.SignIn
14978
15235
  ? "an email or SMS code challenge or a password challenge for single-factor sign-in"
14979
15236
  : "an email or SMS code challenge for single-factor authentication"
14980
15237
  : "a code challenge for multi-factor authentication";
15238
+ if (isExistingAccountSignUp &&
15239
+ authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR) {
15240
+ expectedChallenge =
15241
+ "an email code challenge or a password challenge for existing-account sign-up";
15242
+ }
14981
15243
  const returnedChallenge = result.type === FLOW_CODE_REQUIRED_V2
14982
15244
  ? result.channel
14983
15245
  ? `a '${result.channel}' code challenge`
@@ -14993,24 +15255,143 @@
14993
15255
  });
14994
15256
  }
14995
15257
  }
14996
- async requestSelectedMethodChallenge(method) {
14997
- const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
14998
- const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
14999
- if (!selectedMethod) {
15000
- throw new InvalidArgumentError("method", correlationId);
15001
- }
15002
- const result = await flowClient.requestChallenge({
15003
- correlationId,
15004
- authenticationFactor,
15005
- continuationState: {
15006
- ...continuationState,
15007
- links: {
15008
- ...continuationState.links,
15009
- challenge: selectedMethod.challengeHref,
15010
- },
15011
- },
15012
- });
15013
- return { result, selectedMethod };
15258
+ async requestSelectedMethodChallenge(method) {
15259
+ const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
15260
+ const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
15261
+ if (!selectedMethod) {
15262
+ throw new InvalidArgumentError("method", correlationId);
15263
+ }
15264
+ const result = await flowClient.requestChallenge({
15265
+ correlationId,
15266
+ authenticationFactor,
15267
+ continuationState: {
15268
+ ...continuationState,
15269
+ links: {
15270
+ ...continuationState.links,
15271
+ challenge: selectedMethod.challengeHref,
15272
+ },
15273
+ },
15274
+ });
15275
+ return { result, selectedMethod };
15276
+ }
15277
+ }
15278
+
15279
+ /*
15280
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15281
+ * Licensed under the MIT License.
15282
+ */
15283
+ /**
15284
+ * State returned when sign-in or sign-up requires a password.
15285
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15286
+ */
15287
+ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15288
+ constructor(stateParameters) {
15289
+ super(stateParameters);
15290
+ this.stateType = "passwordRequired";
15291
+ this.requestedPasswordAttribute =
15292
+ stateParameters.requestedPasswordAttribute;
15293
+ }
15294
+ /**
15295
+ * Submits the password and advances the active flow. Use the returned result
15296
+ * to continue the flow.
15297
+ * @param password - The account password.
15298
+ * @returns The result containing the next state or an error.
15299
+ */
15300
+ async submitPassword(password) {
15301
+ const { correlationId, logger, continuationState } = this.stateParameters;
15302
+ try {
15303
+ this.ensurePasswordIsNotEmpty(password);
15304
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
15305
+ return await this.submitSignUpPassword(password);
15306
+ }
15307
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
15308
+ return await this.submitSignInPassword(password);
15309
+ }
15310
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission is not supported for the '${continuationState.scenario}' flow.`, correlationId);
15311
+ }
15312
+ catch (error) {
15313
+ logger.errorPii(`Failed to submit V2 password. Error: '${error}'.`, correlationId);
15314
+ return CustomAuthResultV2.createWithError(error, {
15315
+ scenario: continuationState.scenario,
15316
+ correlationId,
15317
+ });
15318
+ }
15319
+ }
15320
+ async submitSignUpPassword(password) {
15321
+ const { correlationId, continuationState, flowClient } = this.stateParameters;
15322
+ const signUpStateTransitionHandler = this.stateParameters.signUpStateTransitionHandler;
15323
+ if (!signUpStateTransitionHandler) {
15324
+ throw new UnexpectedError("Sign-up state transition handler is missing.", correlationId);
15325
+ }
15326
+ const result = await flowClient.submitSignUpAttributes({
15327
+ correlationId,
15328
+ continuationState,
15329
+ attributes: { password },
15330
+ });
15331
+ return signUpStateTransitionHandler.handleAttributeSubmission(result, { ...this.stateParameters, signUpStateTransitionHandler }, "password");
15332
+ }
15333
+ async submitSignInPassword(password) {
15334
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15335
+ const result = await flowClient.submitSignInPassword({
15336
+ correlationId,
15337
+ continuationState,
15338
+ password,
15339
+ });
15340
+ const resultType = result.type;
15341
+ if (result.type === FLOW_COMPLETED_V2) {
15342
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
15343
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
15344
+ }
15345
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15346
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15347
+ correlationId: result.correlationId,
15348
+ logger,
15349
+ config: this.stateParameters.config,
15350
+ flowClient,
15351
+ continuationState: result.continuationState,
15352
+ cacheClient: this.stateParameters.cacheClient,
15353
+ methods: result.methods,
15354
+ }), undefined, result.continuationState.scenario);
15355
+ }
15356
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
15357
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15358
+ correlationId: result.correlationId,
15359
+ logger,
15360
+ config: this.stateParameters.config,
15361
+ flowClient,
15362
+ continuationState: result.continuationState,
15363
+ cacheClient: this.stateParameters.cacheClient,
15364
+ methods: result.methods,
15365
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15366
+ }), undefined, result.continuationState.scenario);
15367
+ }
15368
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
15369
+ }
15370
+ }
15371
+
15372
+ /*
15373
+ * Copyright (c) Microsoft Corporation. All rights reserved.
15374
+ * Licensed under the MIT License.
15375
+ */
15376
+ class SignInStateTransitionHandlerV2 {
15377
+ handlePasswordRequired(result, stateParameters) {
15378
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
15379
+ ...stateParameters,
15380
+ correlationId: result.correlationId,
15381
+ continuationState: result.continuationState,
15382
+ }), undefined, result.continuationState.scenario);
15383
+ }
15384
+ handleMfaRequired(result, stateParameters) {
15385
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15386
+ correlationId: result.correlationId,
15387
+ logger: stateParameters.logger,
15388
+ config: stateParameters.config,
15389
+ flowClient: stateParameters.flowClient,
15390
+ continuationState: result.continuationState,
15391
+ cacheClient: stateParameters.cacheClient,
15392
+ methods: result.methods,
15393
+ authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15394
+ }), undefined, result.continuationState.scenario);
15014
15395
  }
15015
15396
  }
15016
15397
 
@@ -15019,33 +15400,34 @@
15019
15400
  * Licensed under the MIT License.
15020
15401
  */
15021
15402
  /**
15022
- * State returned when the selected sign-in method requires the user's
15023
- * password.
15403
+ * State returned when the user must supply a new password. Submission can
15404
+ * require method registration or MFA, and the flow is not complete until any
15405
+ * subsequent required actions finish.
15406
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15024
15407
  */
15025
- class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15408
+ class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15026
15409
  constructor() {
15027
15410
  super(...arguments);
15028
- this.stateType = "passwordRequired";
15411
+ this.stateType = "newPasswordRequired";
15029
15412
  }
15030
15413
  /**
15031
- * Submits the password and advances sign-in.
15032
- * @param password - The account password.
15033
- * @returns A completed sign-in, MFA selection, or password submission error.
15414
+ * Submits the new password. The result can require method registration or
15415
+ * MFA, and completion is not final until any subsequent required actions
15416
+ * finish.
15417
+ * @param password - The new password to set.
15418
+ * @returns The result of submitting the new password.
15034
15419
  */
15035
- async submitPassword(password) {
15420
+ async submitNewPassword(password) {
15036
15421
  const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15037
15422
  try {
15038
15423
  this.ensurePasswordIsNotEmpty(password);
15039
- const result = await flowClient.submitSignInPassword({
15424
+ logger.verbose("Submitting V2 new password.", correlationId);
15425
+ const result = await flowClient.submitNewPassword({
15040
15426
  correlationId,
15041
15427
  continuationState,
15042
- password,
15428
+ newPassword: password,
15043
15429
  });
15044
15430
  const resultType = result.type;
15045
- if (result.type === FLOW_COMPLETED_V2) {
15046
- const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
15047
- return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
15048
- }
15049
15431
  if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15050
15432
  return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15051
15433
  correlationId: result.correlationId,
@@ -15069,10 +15451,20 @@
15069
15451
  authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15070
15452
  }), undefined, result.continuationState.scenario);
15071
15453
  }
15072
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
15454
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
15455
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
15456
+ correlationId: result.correlationId,
15457
+ logger,
15458
+ config: this.stateParameters.config,
15459
+ flowClient,
15460
+ continuationState: result.continuationState,
15461
+ cacheClient: this.stateParameters.cacheClient,
15462
+ }), undefined, result.continuationState.scenario);
15463
+ }
15464
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
15073
15465
  }
15074
15466
  catch (error) {
15075
- logger.errorPii(`Failed to submit V2 sign-in password. Error: '${error}'.`, correlationId);
15467
+ logger.errorPii(`Failed to submit V2 new password. Error: '${error}'.`, correlationId);
15076
15468
  return CustomAuthResultV2.createWithError(error, {
15077
15469
  scenario: continuationState.scenario,
15078
15470
  correlationId,
@@ -15085,66 +15477,46 @@
15085
15477
  * Copyright (c) Microsoft Corporation. All rights reserved.
15086
15478
  * Licensed under the MIT License.
15087
15479
  */
15088
- class SignInStateTransitionHandlerV2 {
15089
- handlePasswordRequired(result, stateParameters) {
15090
- return new CustomAuthResultV2(new PasswordRequiredStateV2({
15091
- ...stateParameters,
15092
- correlationId: result.correlationId,
15093
- continuationState: result.continuationState,
15094
- }), undefined, result.continuationState.scenario);
15095
- }
15096
- handleMfaRequired(result, stateParameters) {
15097
- return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
15480
+ class ResetPasswordStateTransitionHandlerV2 {
15481
+ handleNewPasswordRequired(result, stateParameters) {
15482
+ return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
15098
15483
  correlationId: result.correlationId,
15099
15484
  logger: stateParameters.logger,
15100
15485
  config: stateParameters.config,
15101
15486
  flowClient: stateParameters.flowClient,
15102
15487
  continuationState: result.continuationState,
15103
15488
  cacheClient: stateParameters.cacheClient,
15104
- methods: result.methods,
15105
- authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
15106
15489
  }), undefined, result.continuationState.scenario);
15107
15490
  }
15108
15491
  }
15109
15492
 
15110
- /*
15111
- * Copyright (c) Microsoft Corporation. All rights reserved.
15112
- * Licensed under the MIT License.
15113
- */
15114
- class SignUpAttributesRequiredStateBaseV2 extends AuthFlowActionRequiredStateBase {
15115
- constructor(stateParameters) {
15116
- super(stateParameters);
15117
- this.attributes = stateParameters.attributes;
15118
- }
15119
- async submitAttributesAction(attributes) {
15120
- const { correlationId, continuationState, flowClient } = this.stateParameters;
15121
- return flowClient.submitSignUpAttributes({
15122
- correlationId,
15123
- continuationState,
15124
- attributes,
15125
- });
15126
- }
15127
- }
15128
-
15129
15493
  /*
15130
15494
  * Copyright (c) Microsoft Corporation. All rights reserved.
15131
15495
  * Licensed under the MIT License.
15132
15496
  */
15133
15497
  /**
15134
15498
  * State returned when sign-up requires profile or custom attributes.
15499
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
15135
15500
  */
15136
- class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
15137
- constructor() {
15138
- super(...arguments);
15501
+ class AttributesRequiredStateV2 extends AuthFlowActionRequiredStateBase {
15502
+ constructor(stateParameters) {
15503
+ super(stateParameters);
15139
15504
  this.stateType = "attributesRequired";
15505
+ this.attributes = stateParameters.attributes;
15140
15506
  }
15141
15507
  /**
15142
- * Submits the attributes requested by the latest server response.
15508
+ * Submits the supplied attributes, including an empty object, to the service.
15509
+ * The returned result identifies the next step or a submission failure.
15143
15510
  */
15144
15511
  async submitAttributes(attributes) {
15145
- const { correlationId, logger, continuationState } = this.stateParameters;
15512
+ const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
15146
15513
  try {
15147
- const result = await this.submitAttributesAction(attributes);
15514
+ const filteredAttributes = filterReservedSignUpAttributesV2(attributes, logger, correlationId);
15515
+ const result = await flowClient.submitSignUpAttributes({
15516
+ correlationId,
15517
+ continuationState,
15518
+ attributes: filteredAttributes,
15519
+ });
15148
15520
  return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "attribute");
15149
15521
  }
15150
15522
  catch (error) {
@@ -15161,53 +15533,23 @@
15161
15533
  * Copyright (c) Microsoft Corporation. All rights reserved.
15162
15534
  * Licensed under the MIT License.
15163
15535
  */
15164
- /**
15165
- * State returned when sign-up requires a password that was not submitted with
15166
- * an earlier attribute request.
15167
- */
15168
- class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
15169
- constructor(stateParameters) {
15170
- super(stateParameters);
15171
- this.stateType = "passwordRequired";
15172
- this.requiredPasswordAttribute =
15173
- stateParameters.requiredPasswordAttribute;
15174
- }
15536
+ class SignUpStateTransitionHandlerV2 {
15175
15537
  /**
15176
- * Submits the password and any profile attributes requested alongside it.
15538
+ * Maps new-account verification and attribute-submission outcomes to public states.
15177
15539
  */
15178
- async submitPassword(password, attributes = {}) {
15179
- const { correlationId, logger, continuationState } = this.stateParameters;
15180
- try {
15181
- this.ensurePasswordIsNotEmpty(password);
15182
- const result = await this.submitAttributesAction({
15183
- ...attributes,
15184
- password,
15185
- });
15186
- return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "password");
15187
- }
15188
- catch (error) {
15189
- logger.errorPii(`Failed to submit V2 sign-up password. Error: '${error}'.`, correlationId);
15190
- return CustomAuthResultV2.createWithError(error, {
15191
- scenario: continuationState.scenario,
15192
- correlationId,
15193
- });
15194
- }
15195
- }
15196
- }
15197
-
15198
- /*
15199
- * Copyright (c) Microsoft Corporation. All rights reserved.
15200
- * Licensed under the MIT License.
15201
- */
15202
- class SignUpStateTransitionHandlerV2 {
15203
15540
  handleAttributeSubmission(result, stateParameters, submission) {
15541
+ const resultType = result.type;
15204
15542
  const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
15205
- if (result.type === FLOW_CODE_REQUIRED_V2) {
15206
- return new CustomAuthResultV2(new CodeRequiredStateV2({
15543
+ if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
15544
+ return new CustomAuthResultV2(new PasswordRequiredStateV2({
15207
15545
  ...commonStateParameters,
15208
- sentTo: result.sentTo,
15209
- channel: result.channel,
15210
- codeLength: result.codeLength,
15546
+ requestedPasswordAttribute: result.requestedPasswordAttribute,
15547
+ }), undefined, result.continuationState.scenario);
15548
+ }
15549
+ if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
15550
+ return new CustomAuthResultV2(new AttributesRequiredStateV2({
15551
+ ...commonStateParameters,
15552
+ attributes: result.attributes,
15211
15553
  }), undefined, result.continuationState.scenario);
15212
15554
  }
15213
15555
  if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
@@ -15219,21 +15561,7 @@
15219
15561
  methods: result.methods,
15220
15562
  }), undefined, result.continuationState.scenario);
15221
15563
  }
15222
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
15223
- }
15224
- handleVerification(result, stateParameters) {
15225
- const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
15226
- if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
15227
- return new CustomAuthResultV2(new AttributesRequiredStateV2({
15228
- ...commonStateParameters,
15229
- attributes: result.attributes,
15230
- }), undefined, result.continuationState.scenario);
15231
- }
15232
- return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
15233
- ...commonStateParameters,
15234
- attributes: result.attributes,
15235
- requiredPasswordAttribute: result.requiredPasswordAttribute,
15236
- }), undefined, result.continuationState.scenario);
15564
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${resultType}' is not supported.`, stateParameters.correlationId);
15237
15565
  }
15238
15566
  createCommonStateParameters(result, stateParameters) {
15239
15567
  return {
@@ -21357,37 +21685,38 @@
21357
21685
  }, e);
21358
21686
  throw e;
21359
21687
  }
21360
- // check if the tokens can be retrieved from internal cache
21361
- let cachedResult;
21362
- try {
21363
- cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
21364
- }
21365
- catch (e) {
21366
- if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
21367
- this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy", this.correlationId);
21688
+ if (this.apiId === ApiId.acquireTokenSilent_silentFlow) {
21689
+ let cachedResult;
21690
+ try {
21691
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest, cacheLookupPolicy);
21692
+ }
21693
+ catch (e) {
21694
+ if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
21695
+ this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy", this.correlationId);
21696
+ nativeATMeasurement.add({
21697
+ isNativeBroker: false,
21698
+ });
21699
+ nativeATMeasurement.end({
21700
+ success: false,
21701
+ });
21702
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21703
+ throw e;
21704
+ }
21705
+ // continue with a native call for any and all errors
21706
+ this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call", this.correlationId);
21707
+ }
21708
+ if (cachedResult) {
21709
+ // Served from the native internal cache; token did not come directly from the broker
21368
21710
  nativeATMeasurement.add({
21369
21711
  isNativeBroker: false,
21370
21712
  });
21371
21713
  nativeATMeasurement.end({
21372
- success: false,
21714
+ success: true,
21715
+ fromCache: true,
21373
21716
  });
21374
- await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21375
- throw e;
21717
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
21718
+ return cachedResult;
21376
21719
  }
21377
- // continue with a native call for any and all errors
21378
- this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call", this.correlationId);
21379
- }
21380
- if (cachedResult) {
21381
- // Served from the native internal cache; token did not come directly from the broker
21382
- nativeATMeasurement.add({
21383
- isNativeBroker: false,
21384
- });
21385
- nativeATMeasurement.end({
21386
- success: true,
21387
- fromCache: true,
21388
- });
21389
- await this.resetGeneratedDpopRequestKey(nativeRequest);
21390
- return cachedResult;
21391
21720
  }
21392
21721
  // dispatch the request to the broker
21393
21722
  try {
@@ -21478,12 +21807,18 @@
21478
21807
  };
21479
21808
  }
21480
21809
  /**
21481
- * Fetches the tokens from the cache if un-expired
21810
+ * Fetches unexpired tokens when allowed by cache policy.
21482
21811
  * @param nativeAccountId
21483
21812
  * @param request
21484
- * @returns authenticationResult
21813
+ * @param cacheLookupPolicy
21814
+ * @returns Cached result, or undefined when cache policy bypasses lookup.
21485
21815
  */
21486
- async acquireTokensFromCache(nativeAccountId, request) {
21816
+ async acquireTokensFromCache(nativeAccountId, request, cacheLookupPolicy = CacheLookupPolicy.Default) {
21817
+ if (cacheLookupPolicy === CacheLookupPolicy.RefreshTokenAndNetwork ||
21818
+ cacheLookupPolicy === CacheLookupPolicy.Skip) {
21819
+ this.logger.verbose("Native cache lookup bypassed for cache policy", this.correlationId);
21820
+ return undefined;
21821
+ }
21487
21822
  if (!nativeAccountId) {
21488
21823
  this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided", this.correlationId);
21489
21824
  throw createClientAuthError(noAccountFound, this.correlationId);
@@ -21833,7 +22168,7 @@
21833
22168
  async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
21834
22169
  // Store the account info and hence `nativeAccountId` in browser cache
21835
22170
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
21836
- // Remove any existing cached tokens for this account in browser storage
22171
+ // Remove cached web access and refresh tokens, preserving ID tokens.
21837
22172
  if (clearExistingTokens) {
21838
22173
  this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
21839
22174
  }
@@ -27118,6 +27453,7 @@
27118
27453
  super(operatingContext);
27119
27454
  this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
27120
27455
  this.signInStateTransitionHandlerV2 = new SignInStateTransitionHandlerV2();
27456
+ this.resetPasswordStateTransitionHandlerV2 = new ResetPasswordStateTransitionHandlerV2();
27121
27457
  if (!this.isBrowserEnvironment) {
27122
27458
  this.logger.verbose("The SDK can only be used in a browser environment.", "");
27123
27459
  throw new UnsupportedEnvironmentError();
@@ -27394,7 +27730,7 @@
27394
27730
  const correlationId = this.getCorrelationId(inputs);
27395
27731
  try {
27396
27732
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27397
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27733
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27398
27734
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27399
27735
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27400
27736
  }
@@ -27418,6 +27754,7 @@
27418
27754
  flowClient: this.flowClientV2,
27419
27755
  continuationState: result.continuationState,
27420
27756
  cacheClient: this.cacheClient,
27757
+ resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
27421
27758
  method: result.method,
27422
27759
  sentTo: result.sentTo,
27423
27760
  channel: result.channel,
@@ -27433,6 +27770,7 @@
27433
27770
  cacheClient: this.cacheClient,
27434
27771
  methods: result.methods,
27435
27772
  authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
27773
+ resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
27436
27774
  }), undefined, result.continuationState.scenario);
27437
27775
  }
27438
27776
  catch (error) {
@@ -27447,7 +27785,7 @@
27447
27785
  const correlationId = this.getCorrelationId(inputs);
27448
27786
  try {
27449
27787
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27450
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27788
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27451
27789
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27452
27790
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27453
27791
  }
@@ -27459,13 +27797,9 @@
27459
27797
  const result = await this.flowClientV2.signIn({
27460
27798
  correlationId,
27461
27799
  username: inputs.username,
27462
- password: inputs.password,
27463
27800
  scopes: inputs.scopes,
27464
27801
  claims: inputs.claims,
27465
27802
  });
27466
- if (result.type === FLOW_COMPLETED_V2) {
27467
- return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
27468
- }
27469
27803
  if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
27470
27804
  return new CustomAuthResultV2(new PasswordRequiredStateV2({
27471
27805
  correlationId: result.correlationId,
@@ -27476,17 +27810,6 @@
27476
27810
  cacheClient: this.cacheClient,
27477
27811
  }), undefined, result.continuationState.scenario);
27478
27812
  }
27479
- if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
27480
- return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
27481
- correlationId: result.correlationId,
27482
- logger: this.logger,
27483
- config: this.customAuthConfig,
27484
- flowClient: this.flowClientV2,
27485
- continuationState: result.continuationState,
27486
- cacheClient: this.cacheClient,
27487
- methods: result.methods,
27488
- }), undefined, result.continuationState.scenario);
27489
- }
27490
27813
  if (result.type === FLOW_CODE_REQUIRED_V2) {
27491
27814
  return new CustomAuthResultV2(new CodeRequiredStateV2({
27492
27815
  correlationId: result.correlationId,
@@ -27515,18 +27838,6 @@
27515
27838
  signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27516
27839
  }), undefined, result.continuationState.scenario);
27517
27840
  }
27518
- if (result.type === FLOW_MFA_REQUIRED_V2) {
27519
- return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
27520
- correlationId: result.correlationId,
27521
- logger: this.logger,
27522
- config: this.customAuthConfig,
27523
- flowClient: this.flowClientV2,
27524
- continuationState: result.continuationState,
27525
- cacheClient: this.cacheClient,
27526
- methods: result.methods,
27527
- authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
27528
- }), undefined, result.continuationState.scenario);
27529
- }
27530
27841
  throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
27531
27842
  }
27532
27843
  catch (error) {
@@ -27541,11 +27852,7 @@
27541
27852
  const correlationId = this.getCorrelationId(inputs);
27542
27853
  try {
27543
27854
  ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
27544
- ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
27545
- if (Object.prototype.hasOwnProperty.call(inputs, "password")) {
27546
- ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
27547
- ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
27548
- }
27855
+ this.ensureUsernameIsValidV2(inputs.username, correlationId);
27549
27856
  if (inputs.scopes !== undefined && inputs.scopes !== null) {
27550
27857
  ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
27551
27858
  }
@@ -27557,39 +27864,61 @@
27557
27864
  const result = await this.flowClientV2.signUp({
27558
27865
  correlationId,
27559
27866
  username: inputs.username,
27560
- password: inputs.password,
27561
- attributes: inputs.attributes,
27562
27867
  scopes: inputs.scopes,
27563
27868
  claims: inputs.claims,
27869
+ attributes: inputs.attributes,
27564
27870
  });
27565
- const commonStateParameters = {
27566
- correlationId: result.correlationId,
27567
- logger: this.logger,
27568
- config: this.customAuthConfig,
27569
- flowClient: this.flowClientV2,
27570
- continuationState: result.continuationState,
27571
- cacheClient: this.cacheClient,
27572
- signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
27573
- };
27574
27871
  if (result.type === FLOW_CODE_REQUIRED_V2) {
27575
27872
  return new CustomAuthResultV2(new CodeRequiredStateV2({
27576
- ...commonStateParameters,
27873
+ correlationId: result.correlationId,
27874
+ logger: this.logger,
27875
+ config: this.customAuthConfig,
27876
+ flowClient: this.flowClientV2,
27877
+ continuationState: result.continuationState,
27878
+ cacheClient: this.cacheClient,
27879
+ signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
27577
27880
  sentTo: result.sentTo,
27578
27881
  channel: result.channel,
27579
27882
  codeLength: result.codeLength,
27580
27883
  }), undefined, result.continuationState.scenario);
27581
27884
  }
27582
- if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
27583
- return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
27584
- ...commonStateParameters,
27585
- attributes: result.attributes,
27586
- requiredPasswordAttribute: result.requiredPasswordAttribute,
27885
+ if (result.type === FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2) {
27886
+ return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
27887
+ correlationId: result.correlationId,
27888
+ logger: this.logger,
27889
+ config: this.customAuthConfig,
27890
+ flowClient: this.flowClientV2,
27891
+ continuationState: result.continuationState,
27892
+ cacheClient: this.cacheClient,
27893
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27894
+ method: result.method,
27895
+ sentTo: result.sentTo,
27896
+ channel: result.channel,
27897
+ codeLength: result.codeLength,
27587
27898
  }), undefined, result.continuationState.scenario);
27588
27899
  }
27589
- if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
27590
- return new CustomAuthResultV2(new AttributesRequiredStateV2({
27591
- ...commonStateParameters,
27592
- attributes: result.attributes,
27900
+ if (result.type === FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2) {
27901
+ return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2({
27902
+ correlationId: result.correlationId,
27903
+ logger: this.logger,
27904
+ config: this.customAuthConfig,
27905
+ flowClient: this.flowClientV2,
27906
+ continuationState: result.continuationState,
27907
+ cacheClient: this.cacheClient,
27908
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27909
+ }), undefined, result.continuationState.scenario);
27910
+ }
27911
+ if (result.type === FLOW_METHOD_SELECTION_REQUIRED_V2) {
27912
+ return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
27913
+ correlationId: result.correlationId,
27914
+ logger: this.logger,
27915
+ config: this.customAuthConfig,
27916
+ flowClient: this.flowClientV2,
27917
+ continuationState: result.continuationState,
27918
+ cacheClient: this.cacheClient,
27919
+ methods: result.methods,
27920
+ authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
27921
+ signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
27593
27922
  }), undefined, result.continuationState.scenario);
27594
27923
  }
27595
27924
  throw new UnexpectedError("Unsupported native auth V2 sign-up result type.", correlationId);
@@ -27602,6 +27931,9 @@
27602
27931
  });
27603
27932
  }
27604
27933
  }
27934
+ ensureUsernameIsValidV2(username, correlationId) {
27935
+ ensureArgumentIsNotEmptyString("inputs.username", username, correlationId);
27936
+ }
27605
27937
  getCorrelationId(actionInputs) {
27606
27938
  return (actionInputs?.correlationId || this.browserCrypto.createNewGuid());
27607
27939
  }
@@ -28575,8 +28907,8 @@
28575
28907
  return this.customAuthController.resetPassword(resetPasswordInputs);
28576
28908
  }
28577
28909
  /**
28578
- * Starts native auth V2 sign-in and returns the authentication methods
28579
- * offered for the first factor.
28910
+ * Starts native auth V2 sign-in.
28911
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28580
28912
  * @param inputs - Inputs for the sign-in V2 flow.
28581
28913
  * @returns A promise that resolves to the sign-in start result.
28582
28914
  */
@@ -28585,6 +28917,7 @@
28585
28917
  }
28586
28918
  /**
28587
28919
  * Starts native auth V2 sign-up.
28920
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28588
28921
  * @param inputs - Inputs for the sign-up V2 flow.
28589
28922
  * @returns A promise that resolves to the sign-up start result.
28590
28923
  */
@@ -28592,7 +28925,8 @@
28592
28925
  return this.customAuthController.signUpV2(inputs);
28593
28926
  }
28594
28927
  /**
28595
- * Initiates the native auth V2 self-service password reset flow.
28928
+ * Starts native auth V2 self-service password reset.
28929
+ * @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
28596
28930
  * @param {ResetPasswordInputsV2} inputs - Inputs for the reset-password V2 flow
28597
28931
  * @returns {Promise<ResetPasswordStartResultV2>} - A promise that resolves to ResetPasswordStartResultV2
28598
28932
  */
@@ -28661,6 +28995,8 @@
28661
28995
  exports.CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2;
28662
28996
  exports.CustomAuthPublicClientApplication = CustomAuthPublicClientApplication;
28663
28997
  exports.CustomAuthResultV2 = CustomAuthResultV2;
28998
+ exports.ExistingAccountCodeRequiredStateV2 = ExistingAccountCodeRequiredStateV2;
28999
+ exports.ExistingAccountPasswordRequiredStateV2 = ExistingAccountPasswordRequiredStateV2;
28664
29000
  exports.FailedStateV2 = FailedStateV2;
28665
29001
  exports.GetAccessTokenResult = GetAccessTokenResult;
28666
29002
  exports.GetAccountError = GetAccountError;
@@ -28720,7 +29056,6 @@
28720
29056
  exports.SignUpError = SignUpError;
28721
29057
  exports.SignUpFailedState = SignUpFailedState;
28722
29058
  exports.SignUpPasswordRequiredState = SignUpPasswordRequiredState;
28723
- exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
28724
29059
  exports.SignUpResendCodeError = SignUpResendCodeError;
28725
29060
  exports.SignUpResendCodeResult = SignUpResendCodeResult;
28726
29061
  exports.SignUpResult = SignUpResult;