Firebase 电话身份验证不会仅在发布模式下启动 OTP,但即使在为发布模式添加 sha1 后仍可在调试模式下工作

Mut*_*u S 6 android sha1 firebase flutter

步骤我是如何实施的。

按照建议,我一直实施。在调试模式下它非常好。不幸的是,即使我在 firebase 控制台中添加了调试和释放 sha1 密钥,它也无法在发布模式下工作。

步骤 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);
Run Code Online (Sandbox Code Playgroud)

第2步: 这是用于调试和发布模式的 firebase 控制台 sha1 键

添加了所有三个不同的 sha1 键,但仍然无法正常工作:(

我得到的错误:

正如我所说,在调试模式下一切都如预期一样好但在发布模式下,在启动 otp 功能后,立即 PhineVerificationFailed 与空消息和空代码。

如果还有什么我错过了请指教。谢谢大家

abh*_*ena 6

除此之外SHA1- 您还需要SHA256指纹来发布 apk。
我在 firebase google 身份验证方面遇到了类似的问题。
您可以将SHA256指纹添加到 firebase 项目控制台并重试吗?


归档时间:

查看次数:

753 次

最近记录:

5 年,5 月 前