iPhone上的两因素验证?

问题描述 投票:0回答:1

我的nodeJS服务器应用程序中有2FA代码,该代码利用了easyeasy模块来验证所传递的密钥是否有效。我在客户端上使用Google Authenticator应用。我正在使用秘密密钥=“ A0B0C0D0E0F0A1B1C1D1E1F2”。 这在Android设备上很好用。但是,当我在Iphone上尝试相同操作时,会遇到以下问题:

  1. iPhone上的Google Authenticator App不允许我添加密码“ A0B0C0D0E0F0A1B1C1D1E1F2”。似乎它有一些带有秘密密钥的本机规则。
  2. 即使输入Iphone允许的密钥,speakeasy.totp代码也无法验证,并且始终返回FALSE。
  secretKey = "A0B0C0D0E0F0A1B1C1D1E1F2";
  var verified = speakeasy.totp.verify({
    secret: secretKey,
    encoding: 'base32',
    token: userToken
  }); 

if(!verified) {
         // verification failed
    } else {
         // verification ok
    }

如何解决此问题,使其在Android和Iphone设备上均可使用?

注意:该应用程序仍在测试区域中。产品中的秘密密钥将存储在永久性存储区/数据库中。

谢谢。

node.js two-factor-authentication totp
1个回答
0
投票

totp.verify中使用的秘密是小写。当我将其转换为大写字母时,它开始正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.