twilio_phone_verify 2.0.0 copy "twilio_phone_verify: ^2.0.0" to clipboard
twilio_phone_verify: ^2.0.0 copied to clipboard

A Package that helps in verifying phone numbers and email addresses using Twilio.

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:

How to use #

Create a new Object

TwilioPhoneVerify _twilioPhoneVerify; 

Initialize with values

_twilioPhoneVerify = new TwilioPhoneVerify(
        accountSid: '*************************', // replace with Account SID
        authToken: 'xxxxxxxxxxxxxxxxxx',  // replace with Auth Token
        serviceSid: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // replace with Service SID
        );

Phone number verification #

Send Code to Phone
 var twilioResponse =
        await _twilioPhoneVerify.sendSmsCode('phone');

    if (twilioResponse.successful)  {
      //code sent
    } else {
      //print(twilioResponse.errorMessage);
    }
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);
    }

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);
    }
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);
    }
Override Email configurations
 var twilioResponse =
        await _twilioPhoneVerify.sendEmailCode('email',channelConfiguration:
    EmailChannelConfiguration(
        from: "override@example.com",
        from_name: "Override Name",
        template_id: "d-4f7abxxxxxxxxxxxx",
		usernameSubstitution: "Foo Bar"
    ));

    if (twilioResponse.successful)  {
      //code sent
    } else {
      //print(twilioResponse.errorMessage);
    }

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.

29
likes
130
points
658
downloads

Publisher

unverified uploader

Weekly Downloads

A Package that helps in verifying phone numbers and email addresses using Twilio.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, http

More

Packages that depend on twilio_phone_verify