Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

Verification

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

prepareVerification()

The prepareVerification is used to initiate the verification process for a field that requires it. As mentioned above, there are two fields that need to be verified:

  • emailAddress: The email address can be verified via an email code. This is a one-time code that is sent to the email already provided to the SignUp object. The prepareVerification sends this email.
  • phoneNumber: The phone number can be verified via a phone code. This is a one-time code that is sent via an SMS to the phone already provided to the SignUp object. The prepareVerification sends this SMS.
function prepareVerification(params: PrepareVerificationParams): Promise<SignUpResource>;

PrepareVerificationParams

NameTypeDescription
strategy'phone_code' | 'email_code' | 'email_link' | 'saml' | 'oauth_<provider>' | 'web3_metamask_signature'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.
  • email_code: Send an email with a unique token to input.
  • email_link: Send an email with a link which validates sign-up
  • saml: The user will be authenticated with SAML. Experimental
  • oauth_<provider>: The user will be authenticated with their social sign-in account. See available OAuth providers.
  • web3_metamask_signature: The verification will attempt to be completed using the user's web3 wallet public address. The web3_wallet_id parameter can also be specified to select which of the user's known web3 wallets will be used. Currently Clerk supports Metamask(opens in a new tab).
redirectUrlstringThe URL to redirect the user to after the verification process is complete.
Only supported on email_link, oauth_<provider>, and saml strategies.

prepareVerification() returns

TypeDescription
Promise<SignUpResource>This method returns a Promise which resolves to the current SignUp.

attemptVerification()

Attempts to complete the in-flight verification process that corresponds to the given strategy. In order to use this method, you should first initiate a verification process by calling SignUp.prepareVerification.

Depending on the strategy, the method parameters could differ.

function attemptVerification(params: AttemptVerificationParams): Promise<SignUp>;

AttemptVerificationParams

NameTypeDescription
strategy'phone_code' | 'email_code' | 'web3_metamask_signature'The verification strategy to complete the user's sign-up request against.
The following strategies are supported:
  • phone_code: Validates an SMS with a unique token to input.
  • email_code: Validates an email with a unique token to input.
  • web3_metamask_signature: The verification will attempt to be completed using the user's web3 wallet public address. The web3_wallet_id parameter can also be specified to select which of the user's known web3 wallets will be used. Currently Clerk supports Metamask(opens in a new tab).
codestringThe code that was sent to the user via the phone_code or email_code verification strategies.
signaturestringThe signature that was sent to the user via the Web3 verification strategy.

attemptVerification() returns

TypeDescription
Promise<SignUpResource>This method returns a Promise which resolves to the current SignUp.

Last updated on March 19, 2024

What did you think of this content?

Clerk © 2024