问题描述
是否可以通过API获得OTP?我有一个需要2fa的API.当然可以将其关闭,但我真的很想不这样做.
Is there some way to get an OTP by API?I have an API that requires 2fa.Of course is is possible to turn it off, but I'd really much rather not to.
推荐答案
我可以帮您解决这个问题.仅供参考,我与Authy合作.您是否打算获取OTP代码并随后自动验证该代码?出于好奇,您是否正在执行此操作以进行集成测试?
I can help you out with this. FYI, I work with Authy. Is your intention to get an OTP code and subsequently verify the code automatically? Just out of curiosity, are you doing this for integration testing?
您可以通过以下方式与Authy取得联系:
You could approach this with Authy by:
- 购买Twilio VOIP号码
- 将Twilio VOIP号码的SMS Webhook设置为API端点
- 向该号码请求电话验证或Authy 2FA OTP令牌(注意:如果您要请求Authy OneCode OTP,则必须先在Authy中注册该号码)
- 这时,OTP将通过SMS webhook传递到您的API端点
- 解析OTP并验证Authy 2FA令牌的电话验证.
如果您要进行此测试,可以在 Github .
If you are approaching this for testing, you can see a testing-sample app for both Phone Verification and Authy OneCode on Github.
还可以在 Github 上获得其他示例API调用.
Additional sample API calls are also available on Github.
此致
Josh @ Authy
Josh @ Authy
这篇关于如何通过API获取Google或Authy OTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!