【发布时间】:2019-04-24 02:36:36
【问题描述】:
我正在尝试使用谷歌身份验证器创建一个使用双因素身份验证器的网络应用,所以我的问题是,是否有用于谷歌身份验证器的 api?
【问题讨论】:
我正在尝试使用谷歌身份验证器创建一个使用双因素身份验证器的网络应用,所以我的问题是,是否有用于谷歌身份验证器的 api?
【问题讨论】:
有很多关于如何为 Google Authenticator 创建自己的客户端的示例,但是,您也可以使用 API,这可能更容易。
首先,您创建一个二维码进行配对,结合您的应用描述,以及如下密码;
https://www.authenticatorApi.com/pair.aspx?AppName=MyApp&AppInfo=John&SecretCode=12345678BXYT
然后,一旦用户配对,您就可以使用 validate API 调用来验证他们的 PIN;
https://www.authenticatorApi.com/Validate.aspx?Pin=123456&SecretCode=12345678BXYT
此 API 的源代码可在此处作为 GitHub 上的开源代码获得; https://github.com/infiniteloopltd/AuthenticatorAPI.com
【讨论】:
是的,快速浏览:
您的用户下载 Google 身份验证器应用 https://apps.apple.com/us/app/google-authenticator/id388497605 或 https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en&gl=US
您代表您的用户生成一个“秘密”代码:
https://google-authenticator.p.rapidapi.com/new/
服务器将返回密码(例如“GXPTBCTI4DX4UFJB”),请保留密码,因为您在第 3 步和第 4 步将需要它。
您通过以下方式为用户生成二维码:
https://google-authenticator.p.rapidapi.com/enroll/?secret=GXPTBCTI4DX4UFJB&account=JohnDoe&issuer=AcmeCorp
用户使用 Google Authenticator 应用扫描二维码,现在会生成临时代码。
现在您可以通过以下方式验证代码:
https://google-authenticator.p.rapidapi.com/validate/?code=266677&secret=GXPTBCTI4DX4UFJB
希望这会有所帮助。
【讨论】: