那个二维码( 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.