0 purchases
twilio phone verify
Twilio_Phone_Verify #
A Package that helps in verifying phone numbers and email addresses using Twilio.
Usage #
To use this package :
add the dependency to your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
twilio_phone_verify:
copied to clipboard
How to use #
Create a new Object
TwilioPhoneVerify _twilioPhoneVerify;
copied to clipboard
Initialize with values
_twilioPhoneVerify = new TwilioPhoneVerify(
accountSid: '*************************', // replace with Account SID
authToken: 'xxxxxxxxxxxxxxxxxx', // replace with Auth Token
serviceSid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // replace with Service SID
);
copied to clipboard
Phone number verification #
Send Code to Phone
var twilioResponse =
await _twilioPhoneVerify.sendSmsCode('phone');
if (twilioResponse.successful) {
//code sent
} else {
//print(twilioResponse.errorMessage);
}
copied to clipboard
Verify Code
var twilioResponse = await _twilioPhoneVerify.verifySmsCode(
phone: 'phone', code: 'code');
if (twilioResponse.successful) {
if (twilioResponse.verification.status == VerificationStatus.approved) {
//print('Phone number is approved');
} else {
//print('Invalid code');
}
} else {
//print(twilioResponse.errorMessage);
}
copied to clipboard
Email Verification #
Twilio Verify email channel requires additional Service configuration. Please refer to the email channel setup documentation for detailed instructions.
Send Code to Email
var twilioResponse =
await _twilioPhoneVerify.sendEmailCode('email');
if (twilioResponse.successful) {
//code sent
} else {
//print(twilioResponse.errorMessage);
}
copied to clipboard
Verify Email Code
var twilioResponse = await _twilioPhoneVerify.verifyEmailCode(
email: 'email', code: 'code');
if (twilioResponse.successful) {
if (twilioResponse.verification.status == VerificationStatus.approved) {
//print('Email is approved');
} else {
//print('Invalid code');
}
} else {
//print(twilioResponse.errorMessage);
}
copied to clipboard
Override Email configurations
var twilioResponse =
await _twilioPhoneVerify.sendEmailCode('email',channelConfiguration:
EmailChannelConfiguration(
from: "[email protected]",
from_name: "Override Name",
template_id: "d-4f7abxxxxxxxxxxxx",
usernameSubstitution: "Foo Bar"
));
if (twilioResponse.successful) {
//code sent
} else {
//print(twilioResponse.errorMessage);
}
copied to clipboard
Features #
✅ Phone verification
✅ Email verification.
Getting Started #
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.