Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

SreenivasR/AUTHY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AUTHY

This snippet allows you to verify user's mobile number using AUTHY. You need to create an account to get the API key.(https://www.authy.com/login)

Preview

Server Information:
Node.js v6.2.0 (https://nodejs.org/en/)

Updating npm to latest version
npm install npm@latest -g

Dependencies :

  1. npm install request
  2. npm install httpdispatcher

Using test environment:

  1. Navigate to the cloned folder.
  2. Run the code using the command "node validate.js".
  3. You can check the server status by visting the URL http://localhost:8922 .

Step 1: Get the verification code :
You will start the authentication process by sending an user's mobile number and his country(ISD) code to the server. Once this is done, user will receive a text message with a verification code.

REQUEST :

Content-Type : application/json
POST http://localhost:8922/register
postData: {"via":"sms","phone_number":"1234567890","country_code”:"01","locale":"en”}

RESPONSE:

{
    "carrier": “Sprint Ltd",
    "is_cellphone": true,
    "message": "Text message sent to +01 123-456-7890.",
    "seconds_to_expire": 599,
    "uuid": “eeeeee-ffff-gggg-hhh-opopopop",
    "success": true
}

Step 2: Verification flow :
After completing the first step, pass the verification code sent to the user's mobile number to the API. So that we can confirm the authenticity of the user's mobile number.

REQUEST :
Content-Type : application/json
GET http://localhost:8922/verify?phone_number=1234567890&country_code=01&verification_code=XXZZ

RESPONSE:

Output for Valid code:

    {"message":"Verification code is correct.","success”:true}

Output for Invalid code or retrying the same code for more than one time:

    {"message":"No pending verifications for +01 123-45-6789 found.”, "success":false, "errors":{"message":"No pending verifications for +01 123-45-6789 found."},"error_code":”60023”}

About

NodeJS server code for Phone number authentication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors