how to get Google or Authy OTP by API

余生长醉 提交于 2019-12-12 04:23:46

问题


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.


回答1:


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?

You could approach this with Authy by:

  1. Purchasing a Twilio VOIP number
  2. Setting the SMS webhook of the Twilio VOIP number to an API endpoint
  3. Requesting a Phone Verification or Authy 2FA OTP token to that number (NOTE: if you're requesting an Authy OneCode OTP, you will first have to register the number with Authy)
  4. At this point, the OTP will be delivered to your API endpoint via the SMS webhook
  5. Parse the OTP and verify the Phone Verification of Authy 2FA token.

If you are approaching this for testing, you can see a testing-sample app for both Phone Verification and Authy OneCode on Github.

Additional sample API calls are also available on Github.

Regards,

Josh @ Authy



来源:https://stackoverflow.com/questions/41954208/how-to-get-google-or-authy-otp-by-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!