Phone Number Plugin
Implement phone number verification and password reset functionality using SMS-based one-time passwords.
Available Methods
Send OTP
Sends a one-time password to the user's phone number.
await client.phoneNumber.sendOTP(
phoneNumber: '+1234567890',
);
Verify Phone Number
Verifies the phone number using the OTP sent to the user's phone.
final response = await client.phoneNumber.verifyPhoneNumber(
phoneNumber: '+1234567890',
code: '123456',
disableSession: false, // optional
updatePhoneNumber: true, // optional
);
Password Reset
Forgot Password
Initiates the password reset process by sending an OTP to the user's phone number.
final response = await client.phoneNumber.forgotPassword(
phoneNumber: '+1234567890',
);
Reset Password
Resets the user's password using the OTP sent to their phone number.
final response = await client.phoneNumber.resetPassword(
phoneNumber: '+1234567890',
otp: '123456',
newPassword: 'new-password',
);
Error Handling
All methods in the Phone Number plugin throw exceptions when operations fail. The error messages are automatically extracted from the server response and thrown as exceptions. You should wrap all phone number plugin calls in try-catch blocks:
try {
await client.phoneNumber.sendOTP(
phoneNumber: '+1234567890',
);
// Handle success
} catch (e) {
// Handle error
print('Error: $e');
}
Organization Plugin
Manage organizations, members, and invitations with comprehensive organization management features including role-based access control, member management, and organization settings.
Two Factor Authentication Plugin
Add an extra layer of security to your application with two-factor authentication using TOTP, OTP, and backup codes.