How to use twilio verify to redirect user to login or register on mobile?

I would like to verify phone BEFORE letting users access /login or /register routes just like Uber does. Is there a way after validating phone I can grant user right to access /login or register? I notice that Twilio return a json object with sid, is it unique? can it be used as a temp token to access protected route such as /login and register? After verifying the phone number how can I check if this user has been really verified so he can login or register?

https://1fykyq3mdn5r21tpna3wkdyi-wpengine.netdna-ssl.com/wp-content/uploads/2017/12/Figure-3-768x892.png

Answers

  • ElactixNova
    edited March 1

    You can check out this twilio article https://www.twilio.com/code-exchange/one-time-passcode-verification-otp


    If the user is successfully verified then the check-verify.js function returns the JSON output

    {

    "success" : true,

    "message: 'Verification success.'

    }


    Which can then be used to give access to /login or /register routes.

  • Hi @jeph3000 ,

    As you may know, Verify is our product to perform 2FA using different channels, like SMS, Voice Call, email, and others. You can find all the documentation needed to deploy Verify at Verify API, however, the flow to use Verify V2 in a production scenario would be like this:

    1. Create a Verify service (only one for all your verifications, can be created in Twilio console)

    2. Your user log in or start a process that requires 2FA using a phone number (Frontend)

    3. You make a call to the verify API to start a verification (Backend)

    4. An SMS is sent to your user to the phone number in step 2.

    5. Your user enters the code received (Frontend)

    6. You receive the code entered by your user, and start a verification check (Backend)

    7. The API will give a response whether the OTP entered by your customer is correct or not.

    8. The transaction/log in is approved depending on the response in step 7.

    Please review, and let me know if you have further questions, in addition, please let me know if you've already tried doing this integration and if so, could you please share with me the results?

     I'll remain attentive to your answer.

If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support