如何为Google Authenticator生成一个QR码,以正确显示OTP上方显示的Issuer? [英] How to generate a QR Code for Google Authenticator that correctly shows Issuer displayed above the OTP?
问题描述
警告:与第三方共享您的TOTP种子打破了多因素身份验证的基本假设,即TOTP 种子是秘密.
Warning: sharing your TOTP seed with third-parties breaks the very basic assumption of multi-factor authentication that the TOTP seed is secret.
So, I'm aware of the documentation on this, found here: Google Authenticator Key URI Format
当我按照该页面上的示例进行操作时:
When I follow this example from that page:
otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
然后我将其拼接"到Google Charts URL中,因此:
And I 'splice' it into a Google Charts URL, thus:
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
它将显示有效的QR码,如果我使用手机上的Google Authenticator应用对其进行扫描,它将开始生成有效的OTP.
It will display a valid QR code, and if I scan it with my Google Authenticator app on my phone, it will begin to generate valid OTPs.
但是,在电话的显示屏上,对于QR码创建的条目,我得到了OTP,在其下,我得到了"Example:alice@google.com".我想要的是在OTP上方上方显示示例",在OTP下方下方显示"alice@google.com".我不禁注意到所有专业制作的应用程序就是这样做的.例如,Google,Wordpress,Amazon等.公司名称在OTP上方 ,用户名显示在OTP下方 .是的,这纯粹是一个装饰性问题,但我想解决这个问题.
However, in the display on the phone, for the entry created by the QR code, I get the OTP, and under it, I get 'Example:alice@google.com'. What I want, is to have 'Example' displayed above the OTP, and 'alice@google.com' displayed below the OTP. I can't help but notice that's the way all the professionally produced apps do it. For example, Google, Wordpress, Amazon, etc. The company name is above the OTP, and the username is displayed below the OTP. Yes, this is purely a cosmetic issue, but I want to get it right.
有人可以给我一个线索吗?
Can anyone offer me a clue?
推荐答案
警告:与第三方共享您的TOTP种子打破了多因素身份验证的基本假设,即TOTP 种子是秘密.
Warning: sharing your TOTP seed with third-parties breaks the very basic assumption of multi-factor authentication that the TOTP seed is secret.
只是弄清楚了.
事实证明,我需要对'oauth'中的所有特殊字符进行编码,即'$','%','='等.
As it turns out, I needed to encode all the special characters in the 'oauth', i.e., '$', '%', '=', etc.
因此,使用与以前相同的Google Charts URL,但是对这些字符进行编码,如下所示:
So, using the same Google Charts URL as before, but encoding those characters, like this:
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/Example%3Aalice%40google.com%3Fsecret%3DJBSWY3DPEHPK3PXP%26issuer%3DExample
它可以正常工作.
这篇关于如何为Google Authenticator生成一个QR码,以正确显示OTP上方显示的Issuer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!