prepareSecondFactor

Prepares an explicit second-factor strategy, including passkeys.


suspend fun SignIn.prepareSecondFactor(phoneNumberId: String? = null, emailAddressId: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Deprecated

Use sendMfaPhoneCode(phoneNumberId) or sendMfaEmailCode(emailAddressId), or prepareSecondFactor(PrepareSecondFactorStrategy) to pick the channel explicitly. Called with no ids, this picks phone and then email; sendMfaPhoneCode() and sendMfaEmailCode() each fail when their channel is unavailable, so check supportedSecondFactors to choose. This overload will be removed in the next major version.

Prepares the second factor verification for the sign-in process.

An explicit phoneNumberId sends a phone code to that number, even when supportedSecondFactors does not list it, and wins over emailAddressId. An explicit emailAddressId sends an email code. Without either, the first supported phone code factor is used, then the first supported email code factor.

Return

A ClerkResult containing the updated SignIn object on success, or a ClerkErrorResponse on failure. Fails without contacting Clerk when the sign-in is not awaiting a second factor or no phone or email code factor is available.

Parameters

phoneNumberId

Optional phone number ID to send a phone code to.

emailAddressId

Optional email address ID to send an email code to.