twilio无法验证手机_使用PHP和Twilio进行多因素身份验证

twilio无法验证手机

There are various approaches used to confirm people are in fact who they say they: reference some aspect of the user herself (e.g. biometrics), ask for something the user knows (e.g. a password), or ask for something the user physically has (e.g. an RFID card). Traditional websites implement single-factor authentication, requiring just a user’s password. But multi-factor authentication on the other hand requires verification from at least two of the different approaches and is considerably more secure.

有多种方法可以用来确认人们实际上是在说他们是谁:参考用户本人的某些方面(例如生物特征识别),询问用户知道的内容(例如密码)或询问用户实际拥有的内容(例如RFID卡)。 传统网站执行单因素身份验证,仅需要用户密码。 但是另一方面,多因素身份验证需要至少两种不同方法的验证,并且安全性要高得多。

Using biometrics to authenticate someone to your website is probably still a long ways off with many technological hurdles and civil liberties concerns to overcome. A more practical approach to multi-factor authentication is to implement options from the other two categories, such as requiring a password and a confirmation token sent to the user via phone either by SMS or voice call (the user knows the password, and has a phone). This is what you’ll learn how to implement in this article.

使用生物识别技术对网站上的某人进行身份验证可能还有很长的路要走,要克服许多技术障碍和公民自由问题。 一种更实用的多因素身份验证方法是从其他两个类别中实现选项,例如要求输入密码和通过SMS或语音呼叫通过电话发送给用户的确认令牌(用户知道密码,并且具有电话)。 这就是您将在本文中学习的实现方法。

Telephony integration can be frustrating if you’re doing it from the ground up, and most of the time it’s not practical to build up your own infrastructure (though possible with commodity hardware and programs like Asterisk). Luckily, Twilio offers the infrastructure and an API which developers can use to write interactive telephony applications without much hassle. I’ll be making use of their services in this article.

如果您是从头开始的话,电话集成可能会令人沮丧,并且在大多数情况下,构建自己的基础结构是不切实际的(尽管可以使用商品硬件和程序,例如Asterisk )。 幸运的是, Twilio提供了基础结构和API,开发人员可以使用它们轻松编写交互式电话应用程序。 我将在本文中利用他们的服务。

You can make and receive phone calls and send and receive text messages with Twilio using TwiML (Twilio Markup Language) and their REST API. You can work directly with the API, or use one of the available helper libraries. The library I’ll use here is twilio-php, the library released and officially supported by Twilio.

您可以使用TwiML(Twilio标记语言)及其REST API使用Twilio拨打和接听电话以及收发短信。 您可以直接使用API​​,也可以使用可用的帮助程序库之一 。 我将在这里使用的库是twilio-php ,它是Twilio发布并正式支持的库。

So, are you ready to learn how you can implement multi-factor authentication? Read on!

那么,您准备好学习如何实现多因素身份验证了吗? 继续阅读!

从PHP使用Twilio (Using Twilio from PHP)

Connecting to the Twilio service is as easy as including the twilio-php library and creating a new instance of the Services_Twilio class. The object’s constructor accepts your account’s SID and auth token which are listed on your Twilio account’s dashboard page after you sign up for their service.

连接到Twilio服务就像包含twilio-php库并创建Services_Twilio类的新实例一样容易。 对象的构造函数接受您的帐户的SID和auth令牌,这些令牌在您注册Twilio帐户的仪表板页面后列出。

With an available Services_Twilio instance at your disposal, you can access their API though the account property. account exposes an instance of Services_Twilio_Rest_Account which represents your Twilio account. I’m only using one account here, but it is possible to have multiple sub-accounts. This can be useful for segmentin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值