Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

Phone verification

These are all methods on the SignUp class that allow you to verify a user's sign-up request via a phone number.

preparePhoneNumberVerification()

Helper method that allows you to initiate a verification process for a phone number. It basically sends a one-time code to the phone number already supplied to the current sign up.

This is equivalent to calling SignUp.prepareVerification("phone_code").

function preparePhoneNumberVerification(params?: PreparePhoneNumberVerificationParams): Promise<SignUpResource>;

PreparePhoneNumberVerificationParams

NameTypeDescription
strategy'phone_code'The verification strategy to validate the user's sign-up request.
The following strategies are supported:
  • phone_code: Send an SMS with a unique token to input.

preparePhoneNumberVerification() returns

TypeDescription
Promise<SignUpResource>A Promise which resolves to the current SignUp.

attemptPhoneNumberVerification()

function attemptPhoneNumberVerification(params: AttemptPhoneNumberVerificationParams): Promise<SignUpResource>;

Helper method that attempts to complete the verification process for a phone number. It basically verifies that the supplied code is the same as the one-time code that was sent to the phone number during the prepare verification phase.

This is equivalent to calling SignUp.attemptVerification({strategy: "phone_code", ...params}).

AttemptPhoneNumberVerificationParams

NameTypeDescription
codestringThe code that was sent to the user via SMS.

attemptPhoneNumberVerification() returns

TypeDescription
Promise<SignUpResource>A Promise which resolves to the current SignUp.

Last updated on April 19, 2024

What did you think of this content?

Clerk © 2024