【问题标题】:Is there a Google authenticator API是否有 Google 身份验证器 API
【发布时间】:2019-04-24 02:36:36
【问题描述】:

我正在尝试使用谷歌身份验证器创建一个使用双因素身份验证器的网络应用,所以我的问题是,是否有用于谷歌身份验证器的 api?

【问题讨论】:

标签: google-authenticator


【解决方案1】:

有很多关于如何为 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

【讨论】:

  • 请注意,如果您选择使用这样的 API,您会以极其不安全的方式泄露您的 2FA 凭据。而是使用库作为您选择的语言。
【解决方案2】:

是的,快速浏览:

  1. 您的用户下载 Google 身份验证器应用 https://apps.apple.com/us/app/google-authenticator/id388497605https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en&gl=US

  2. 您代表您的用户生成一个“秘密”代码:

    https://google-authenticator.p.rapidapi.com/new/

    服务器将返回密码(例如“GXPTBCTI4DX4UFJB”),请保留密码,因为您在第 3 步和第 4 步将需要它。

  3. 您通过以下方式为用户生成二维码:

    https://google-authenticator.p.rapidapi.com/enroll/?secret=GXPTBCTI4DX4UFJB&account=JohnDoe&issuer=AcmeCorp

    用户使用 Google Authenticator 应用扫描二维码,现在会生成临时代码。

  4. 现在您可以通过以下方式验证代码:

    https://google-authenticator.p.rapidapi.com/validate/?code=266677&secret=GXPTBCTI4DX4UFJB

在此处查看完整教程https://rapidapi.com/chdan/api/google-authenticator/tutorials/easy-two-factor-authentication-(2fa)-with-google-authenticator

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    • 2020-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多