Skip to content

Latest commit

 

History

History
68 lines (56 loc) · 2.55 KB

README.md

File metadata and controls

68 lines (56 loc) · 2.55 KB

Plivo Two Factor Auth Example

About

This example shows how Plivo APIs can be used to integrate a two factor authentication system into your own web application. This example is built in PHP.

In other languages:

Node.js Done
Python Done
Ruby Done
.NET Done

Set up

Requirements

Local Development

This application verifies your phone number using the two factor authentication system.

  1. Clone this repo.

    git clone git@github.com:plivo/2fa-php-demo.git    
  2. Change your working directory to 2fa-php-demo

    cd 2fa-php-demo
  3. Install the dependencies using the composer.json file. You can use the below command.

    composer install
  4. Change the placeholders in the config.ini file. You should replace the PLIVO_AUTH_ID, PLIVO_AUTH_TOKEN, & PLIVO_NUMBER placeholders. Note: If you do not want to use PHLO, then set the value toPHLO_ID = null

  5. You can get your auth_id & auth_token from your Plivo Console. Please sign up for a Plivo account if you do not have one already.

    Note: Enter your phone number in E.164 format.

  6. Use the below command to start the app.

    php -S localhost:8000

How it works

  1. Enter your phone number and click on Send Verification Code.
  2. This sends an SMS to that number with a random security code in it. The application now shows a text box to enter this code to verify your mobile number.
  3. Once you get the code in the SMS, enter the code in the text box and click Verify. This will tell you whether the code you entered is correct or not.
  4. If you enter the correct code, then the application knows that the phone number belongs to you and thus the number is verified.

Helper libraries for various languages are available on the Plivo github page.