One-Time User Authentication with SMS Using Django and Twilio

前端 未结 3 1681
小鲜肉
小鲜肉 2021-02-05 16:26

I am writing a back-end in Django for a mobile app I am creating. I need to authenticate a user the first time they open the mobile app through SMS to verify it is a real person

3条回答
  •  忘了有多久
    2021-02-05 16:57

    Twilio evangelist and maintainer of django-twilio here.

    What you're looking to build is something very easy to do, I can outline the steps for you here:

    • Create a Django model that stores a user's number and a generated passcode
    • When a new user is created, take their number and SMS them the code using the Twilio REST API
    • When they enter the passcode you sent them, cross reference it with the one stored in the database.
    • If the number is right: verify them, if not, tell them it is wrong and offer to send them an SMS again.

    I hope that is clear, if you have any more questions, feel free to get in touch at paul@twilio.com

提交回复
热议问题