useOtpVerificationRequest hook simplifies OTP verification processes in your application.
It provides an easy-to-use interface for developers to handle OTP verification and securely update user profiles.
The hook returns a verifyOtp function that can be used to finalize the OTP verification process.
This hook is particularly useful when, for example, you need to verify a user’s email address after updating it in their profile,
or when they sign up for the first time.
VerifyOtp Function
The verifyOtp function, provided by the useOtpVerificationRequest hook, allows you to handle the OTP verification process
for your users by submitting the OTP verification token they received, along with which method it applies to.
| Parameters | Type | Description |
|---|---|---|
| verificationToken | string | The OTP verification token received by the user. |
| destination | "email" | "sms" | Where the OTP was sent to. |
The
verifyOtp function does not trigger either
onOtpVerificationFailure or onOtpVerificationSuccess callbacks. This way,
when it fails you can decide whether to try again or declare a “failure”
yourself.