You’re viewing the 2.0 (LTS) docs. View the current 3.0 version of this page.
useVerifyNewAccount hook completes the account verification process after initiating authentication with email or phone number.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook for verifying new accounts with verification codes
useVerifyNewAccount hook completes the account verification process after initiating authentication with email or phone number.
import { useVerifyNewAccount } from "@getpara/react-sdk";
function VerificationFlow() {
const { verifyNewAccount, verifyNewAccountAsync, isPending, error } = useVerifyNewAccount();
const [verificationCode, setVerificationCode] = useState("");
const [identifier, setIdentifier] = useState(""); // email or phone
const handleVerification = async () => {
try {
const result = await verifyNewAccountAsync({
identifier,
verificationCode
});
console.log("Account verified successfully");
} catch (err) {
console.error("Verification failed:", err);
}
};
return (
<div>
<input
type="text"
value={identifier}
onChange={(e) => setIdentifier(e.target.value)}
placeholder="Email or phone used for signup"
/>
<input
type="text"
value={verificationCode}
onChange={(e) => setVerificationCode(e.target.value)}
placeholder="Enter verification code"
maxLength={6}
/>
<button
onClick={handleVerification}
disabled={isPending || !verificationCode || !identifier}
>
{isPending ? "Verifying..." : "Verify Account"}
</button>
</div>
);
}