Git Product home page Git Product logo

twiliophoneverify's Introduction

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: "[email protected]",
        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.

twiliophoneverify's People

Contributors

deuque avatar shreemanarjun avatar nullhandler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.