github 的 2fa 遇到新问题,验证码无效。

查看 72|回复 5
作者:gransh   
昨天在公司匆匆设置了下 github 的 2fa ,用的 microsoft authenticator ,并登录成功。Recovery codes 也存了。
回家想想又下了个 google authenticator ,再加一份。此时家里的 github 网页版还不需要登录,扫了码之后发现出的数字验证码和 microsoft 里的不一样,猜测是回家后二维码变了。于是用 microsoft 又扫了一遍,此时两个码一样了。
今天来公司,用了数字验证码发现一直无效,已经让我稍后再试了。
现在不知道什么原因。

GitHub, Microsoft, 验证码, 无效

gransh
OP
  
又换一个 app 在公司电脑上扫了一遍,6 位数字码确实不一样。同一个 github 账户可以有不一样的二维码吗
gransh
OP
  
用这两个 app 的码都无法登录 github mobile
mschultz   
那个二维码( TOTP secret )只会显示一次。所以如果你想在多个 Authenticators 里保存这个密钥,那么就必须用多个 Authenticators (你的情况是 Microsoft Authenticator 和 Google Authenticator )扫描 **同一个** QR Code 。你也可以截图这个 QR Code 之后扫描(当然,需自行保证截图的安全)。
如果你在公司先设置好了 Microsoft Authenticator 之后点了确认(此时 Microsoft Authenticator 中保存了密钥,我们记为 A );
之后回家又在 GitHub 的设置页面 **再次** 试图设置 2FA ,GitHub 又显示了一个 QR Code ,这次你用 Google Authenticator 扫描了(记为 B ),如果你此时点了确认,那么密钥 A 即失效。
参考文档:
https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication
> To configure authentication via TOTP on multiple devices, during setup, scan the QR code using each device at the same time or save the "setup key", which is the TOTP secret. If 2FA is already enabled and you want to add another device, you must re-configure your TOTP app from your security settings.
mschultz   
@mschultz #3
但根据你的描述,你回家后用 Google Authenticator 和 Microsoft Authenticator 都扫描了新的 QR Code ,也就是说此时(如果点了确认的话)两个 App 中保存的都是密钥 B ,也就是最新生效的密钥,所以不应该有问题。所以你无法登入的情况就很奇怪了。
话说你回家后在 GitHub 设置中第二次扫码之后输入 6 位数字点确认了么?
gransh
OP
  
@mschultz 谢谢,找到原因了。第一我不知道那个 edit 每次点后二维码都会变。第二我昨天在家里扫完码可能忘记验证了。
以至于今天闹出两种码都不能登录的乌龙事件。还好有恢复码
您需要登录后才可以回帖 登录 | 立即注册

返回顶部