Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

one time password - how to get Google or Authy OTP by 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...