Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
function useVerifySmsOTP(): { verifySmsOTP: (options: VerifySmsOTPOptions) => Promise<VerifySmsOTPResult>; };
{ verifySmsOTP: (options: VerifySmsOTPOptions) => Promise<VerifySmsOTPResult>; }
verifySmsOTP()
options
VerifySmsOTPOptions
Promise
VerifySmsOTPResult
function OTPVerification(flowId: string) { const [otp, setOTP] = useState(""); const { verifySmsOTP } = useVerifySmsOTP(); const otpIsValid = useMemo(() => { // Check if the OTP is a 6 digit number return /^[0-9]{6}$/.test(otp); }, [otp]); const handleSubmit = async (e) => { e.preventDefault(); try { const { user } = await verifySmsOTP({ flowId, otp }); // Handle the result console.log(user); } catch (error) { console.error("Failed to verify OTP:", error); } }; return ( <form onSubmit={handleSubmit}> <input type="text" value={otp} onChange={(e) => setOTP(e.target.value)} placeholder="Enter OTP from SMS" aria-label="Enter OTP from SMS" /> <button type="submit" disabled={!otpIsValid}>Verify OTP</button> </form> ); }
Was this page helpful?