[英]Firebase phone auth not initiating OTP only in release mode but works on Debug mode even after added sha1 for release mode
Steps how I implemented.我如何实施的步骤。
As advised, I implemented all the way.按照建议,我一路实施。 It was quite good in debug mode.
在调试模式下非常好。 Unfortunately its not working in release mode even I added my debug and release sha1 keys in firebase console.
不幸的是,即使我在 firebase 控制台中添加了调试和发布 sha1 密钥,它也无法在发布模式下工作。
Step 1. Coding part is here步骤 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);
Added all three different sha1 keys but still not working:(添加了所有三个不同的 sha1 密钥,但仍然无法正常工作:(
Error I am getting:我得到的错误:
As I said, in debug mode all good as expected But in release mode, after initiating the otp function, immediately PhineVerificationFailed with null message and null code.正如我所说,在调试模式下一切正常但在发布模式下,在启动 otp function 后,PhineVerificationFailed 立即出现 null 消息和 null 代码。
If still anything I missed please advice.如果还有什么我遗漏的,请指教。 Thanks all
谢谢大家
Apart from SHA1
- you also need SHA256
thumbprint for release apk.除了
SHA1
- 您还需要SHA256
指纹才能发布 apk。
I faced similar issue for firebase google authentication.我在 firebase google 身份验证方面遇到了类似的问题。
Can you add SHA256
thumbprint to firebase project console and try again ?您可以将
SHA256
指纹添加到 firebase 项目控制台并重试吗?
添加 SHA1 后,您必须从 Google Play 重新安装您的应用。
For my case I was just missing the 'Andoid Device Verification' API for my Firebase project from Google Cloud.对于我的情况,我只是缺少来自 Google Cloud 的 Firebase 项目的“Andoid 设备验证”API。
https://console.cloud.google.com/apis/library/androidcheck.googleapis.com?project={put_your_project_name_here} https://console.cloud.google.com/apis/library/androidcheck.googleapis.com?project={put_your_project_name_here}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.