android - Firebase 手机身份验证仅在发布模式下不启动 OTP,但即使在为发布模式添加 sha1 后也可以在调试模式下工作
问题描述
我如何实施的步骤。
按照建议,我一路实施。在调试模式下非常好。不幸的是,即使我在 Firebase 控制台中添加了我的调试和发布 sha1 键,它也不能在发布模式下工作。
Step 1. 编码部分在这里
final PhoneVerificationCompleted verificationCompleted =
(PhoneAuthCredential user) {
successMessage('Your phone number verified successfully!');
_loginNotifier.validate();
};
final PhoneVerificationFailed verificationFailed = (FirebaseAuthException authException) {
errorMessage('Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
print(
'Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
};
final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
(String verificationId) {
this._verificationId = verificationId;
print("time out");
};
firebaseAuth = FirebaseAuth.instance;
firebaseAuth.verifyPhoneNumber(
phoneNumber: '+$_phoneWithCC',
timeout: const Duration(seconds: 60),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);
添加了所有三个不同的 sha1 键,但仍然无法正常工作:(
我得到的错误:
正如我所说,在调试模式下一切正常但在发布模式下,启动 otp 函数后,立即 PhineVerificationFailed 并显示空消息和空代码。
如果还有什么我错过的,请指教。谢谢大家
解决方案
除了SHA1
- 您还需要SHA256
用于发布 apk 的指纹。
我在 firebase google 身份验证中遇到了类似的问题。
您可以将SHA256
指纹添加到 firebase 项目控制台并重试吗?
推荐阅读
- ajax - 从 AJAX 调用传递数据时,它返回 None 类型
- r - 如果元素等于向量的元素之一,则进行子集化
- typescript - chai 无法比较类类型
- python - 如何在其比例变大时围绕其中心旋转图像(在 Pygame 中)
- css - 如何使用 CSS 将工具提示指针添加到 div
- html - 与 flex-direction 属性混淆
- python - Keras model.summary 函数显示不一致的输出格式
- c# - EF6 CurrentValues.SetValues 将当前值更改为 null
- powershell - 运行 ps 脚本的批处理文件
- javascript - 为什么当我点击提交时表单的参数消失了?