Firebase PhoneAuthentication OTP 未正确显示 APP NAME

Firebase PhoneAuthentication OTP not showing APP NAME correctly

我在 Play 商店中部署了该应用程序。 SHA1 和 SHA256 添加到 firebase 项目设置中。我正在使用 phone 身份验证来接收应用程序的 OTP。消息采用以下格式:

123456 is your verification code for APP_NAME.
LghSMNBa+V

为什么会出现随机刺痛?代码得到验证并且工作正常,但我不希望随消息一起发送随机字符串。

这个问题似乎 Google 与 Play 服务相关,而不是与 Firebase 相关。此外,不清楚您如何输出 String,因为没有提供重现代码。

模板字符串可以在Authentication > Templates > SMS Verification中定义,其中默认模板字符串为:%LOGIN_CODE% is your verification code for %APP_NAME%.。不知道为什么它显示(可能是一些)ID,但是可以简单地用 message.split(".")[0].
Index 拆分字符串 [1] 可能是一个执行 ID,可以在 GCP 中找到它的日志Log Explorer

当它显示 APP_NAME 作为占位符时,您可能首先必须将您的应用程序上传到 Google Play 管理中心,我想至少要进入内部测试轨道(需要审核) .该场景类似于除非发布应用程序,否则应用程序内产品不可见。

供参考:https://play.google.com/console/about/internal-testing

终于,我收到了 Firebase 团队的回复。内容如下:

Thanks for reaching out! This is Estefani and I’ll take care of this case.

On some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action. This uses the SMS Retriever API, which includes an 11 character hash at the end of the SMS message. Unfortunately, it is not possible to change this behavior and the only thing I could do is submit a feature request on your behalf so this behavior can be removed, but even if I do there is no way to tell if it is going to be implemented or not and even if it gets accepted it may take time to be completed.