Verification Interface
TheVerification interface represents a verification code or OTP (One-Time Password) used for authenticating users, verifying email/phone, or resetting passwords.
Unique identifier for the verification record
The email address or phone number that this verification is for
The verification code or OTP token. This is what the user enters to verify their identity.
The type of verification. See Verification Types below.
Timestamp when this verification expires. After this time, the code is no longer valid.
Number of times verification has been attempted. Used to prevent brute force attacks.
Timestamp when the verification was created
Verification Types
TheVerificationType can be one of the following:
OTP sent via SMS for phone authentication
OTP sent via email for email authentication
Email verification link or code sent to confirm email ownership
Password reset token sent to user’s email
OTP sent when user is changing their phone number
Verification Flows
Phone OTP Flow
- User enters their phone number
- System creates a
Verificationrecord with type"phone-otp" - OTP code is sent via SMS
- User enters the code
- System validates the code and creates/updates the user account
Email OTP Flow
- User enters their email address
- System creates a
Verificationrecord with type"email-otp" - OTP code is sent via email
- User enters the code
- System validates the code and creates/updates the user account
Email Verification Flow
- User signs up with email and password
- System creates a
Verificationrecord with type"email-verification" - Verification link/code is sent to the email
- User clicks link or enters code
- Email is marked as verified (
emailVerified: true)
Password Reset Flow
- User requests password reset
- System creates a
Verificationrecord with type"password-reset" - Reset link/code is sent to user’s email
- User clicks link or enters code
- User sets a new password
Usage Example
Verification codes should have a short expiration time (typically 5-15 minutes) and a maximum number of attempts (typically 3-5) to prevent abuse.
Configure OTP settings in
AuthConfig.otp to customize code length, expiration time, max attempts, and SMS message template.