SignIn

@Serializable
data class SignIn(val id: String, val status: SignIn.Status = Status.UNKNOWN, val supportedIdentifiers: List<String>? = null, val identifier: String? = null, val supportedFirstFactors: List<Factor>? = null, val supportedSecondFactors: List<Factor>? = null, val firstFactorVerification: Verification? = null, val secondFactorVerification: Verification? = null, val userData: SignIn.UserData? = null, val createdSessionId: String? = null)

The SignIn object holds the state of the current sign-in process and provides helper methods to navigate and complete the sign-in lifecycle. This includes managing the first and second factor verifications, as well as creating a new session.

The sign-in process follows these steps:

  1. Initiate the Sign-In Process

    Collect the user's authentication information and pass the appropriate parameters to the SignIn.create method to start the sign-in.

  2. Prepare for First Factor Verification

    Users must complete a first factor verification. This can include:

    • Providing a password

    • Using an email link

    • Entering a one-time code (OTP)

    • Authenticating with a Web3 wallet address

    • Providing proof of identity through an external social account (SSO/OAuth).

  3. Complete First Factor Verification

    Attempt to verify the user's first factor authentication details.

  4. Prepare for Second Factor Verification (Optional)

    If multi-factor authentication (MFA) is enabled for your application, prepare the second factor verification for users who have set up 2FA for their account.

  5. Complete Second Factor Verification

    Attempt to verify the user's second factor authentication details if MFA is required.

Constructors

Link copied to clipboard
constructor(id: String, status: SignIn.Status = Status.UNKNOWN, supportedIdentifiers: List<String>? = null, identifier: String? = null, supportedFirstFactors: List<Factor>? = null, supportedSecondFactors: List<Factor>? = null, firstFactorVerification: Verification? = null, secondFactorVerification: Verification? = null, userData: SignIn.UserData? = null, createdSessionId: String? = null)

Types

Link copied to clipboard
sealed interface AttemptFirstFactorParams

A sealed interface defining parameter objects for attempting first factor verification in the sign-in process.

Link copied to clipboard
sealed interface AttemptSecondFactorParams

Parameters for second factor authentication strategies.

Link copied to clipboard

Parameters for authenticating with a redirect to an external provider.

Link copied to clipboard
object Companion
Link copied to clipboard

Container object for sign-in creation parameters and strategies.

Link copied to clipboard

Enumerates the types of credential requests supported by the service.

Link copied to clipboard
sealed interface PrepareFirstFactorParams

A sealed interface defining parameter objects for preparing first factor verification.

Link copied to clipboard
@Serializable
data class PrepareSecondFactorParams(val strategy: String = PHONE_CODE, val phoneNumberId: String? = null, val emailAddressId: String? = null)

A parameter object for preparing the second factor verification.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class ResetPasswordParams(val password: String, val signOutOfOtherSessions: Boolean = false)

Parameters for resetting a user's password during the sign-in process.

Link copied to clipboard
@Serializable
enum Status : Enum<SignIn.Status>

Represents the status of a sign-in process.

Link copied to clipboard
@Serializable
data class UserData(val firstName: String? = null, val lastName: String? = null, val imageUrl: String? = null, val hasImage: Boolean? = null)

An object containing information about the user of the current sign-in. This property is populated only once an identifier is given to the SignIn object.

Properties

Link copied to clipboard
@SerialName(value = "created_session_id")
val createdSessionId: String?

The identifier of the session that was created upon completion of the current sign-in.

Link copied to clipboard
@SerialName(value = "first_factor_verification")
val firstFactorVerification: Verification?

The state of the verification process for the selected first factor.

Link copied to clipboard
val id: String

Unique identifier for this sign in.

Link copied to clipboard

The authentication identifier value for the current sign-in.

Link copied to clipboard
Link copied to clipboard
@SerialName(value = "second_factor_verification")
val secondFactorVerification: Verification?

The state of the verification process for the selected second factor.

Link copied to clipboard

Determines the starting first factor for a sign-in attempt based on the preferred sign-in strategy.

Link copied to clipboard
Link copied to clipboard

The status of the current sign-in.

Link copied to clipboard
@SerialName(value = "supported_first_factors")
val supportedFirstFactors: List<Factor>?

Array of the first factors that are supported in the current sign-in.

Link copied to clipboard
@SerialName(value = "supported_identifiers")
val supportedIdentifiers: List<String>?

Array of all the authentication identifiers that are supported for this sign in.

Link copied to clipboard
@SerialName(value = "supported_second_factors")
val supportedSecondFactors: List<Factor>?

Array of the second factors that are supported in the current sign-in.

Link copied to clipboard
@SerialName(value = "user_data")
val userData: SignIn.UserData?

An object containing information about the user of the current sign-in.

Functions

Link copied to clipboard

Retrieves a list of alternative first factors for the current sign-in attempt, excluding the specified factor and certain strategy types.

Link copied to clipboard

Returns a list of alternative second factors, sorted by a predefined order, excluding the provided factor.

Link copied to clipboard

Attempts to complete the first factor verification process.

Link copied to clipboard

Attempts to complete the second factor verification process.

Link copied to clipboard
suspend fun SignIn.get(rotatingTokenNonce: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Retrieves the current state of the SignIn object from the server.

Link copied to clipboard
Link copied to clipboard

Begins the first factor verification process.

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

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

Link copied to clipboard
suspend fun SignIn.reload(rotatingTokenNonce: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Reloads the SignIn from the server.

Link copied to clipboard
suspend fun SignIn.resetPassword(newPassword: String, signOutOfOtherSessions: Boolean = false): ClerkResult<SignIn, ClerkErrorResponse>

Resets the password after verification.

Link copied to clipboard

Sends a verification code to the specified email or phone.

Link copied to clipboard
suspend fun SignIn.sendEmailCode(emailAddressId: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Sends a verification code to the user's email address for first factor authentication.

Link copied to clipboard
suspend fun SignIn.sendMfaEmailCode(emailAddressId: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Sends a verification code to the user's email address for MFA (second factor) authentication.

Link copied to clipboard
suspend fun SignIn.sendMfaPhoneCode(phoneNumberId: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Sends a verification code to the user's phone number for MFA (second factor) authentication.

Link copied to clipboard
suspend fun SignIn.sendPhoneCode(phoneNumberId: String? = null): ClerkResult<SignIn, ClerkErrorResponse>

Sends a verification code to the user's phone number for first factor authentication.

Link copied to clipboard

Sends a password reset verification code.

Link copied to clipboard

Verifies the first factor with the provided code.

Link copied to clipboard

Verifies MFA with the provided code and type.

Link copied to clipboard

Verifies the first factor with a passkey credential.

Link copied to clipboard

Verifies the first factor with a password.