Skip to content

plivo/2fa-ruby-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 Ruby using Sinatra Framework.

In other languages:

.Net Done
Python Done
Node.js Done
PHP Done

Set up

Requirements

  • Ruby version >= 2.6.x.
  • A Plivo account - sign up

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-ruby-demo.git    
  2. Change your working directory to 2fa-ruby-demo

    cd 2fa-ruby-demo
  3. Install the dependencies using the Gemfile. You can use the below command.

    bundle install
  4. Change the placeholders in the config.yaml file. You should replace the PLIVO_AUTH_ID, PLIVO_AUTH_TOKEN, PLIVO_NUMBER & PHLO_ID 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.

    ruby app.rb

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published