介绍如何实施。
根据建议,我一直执行。在调试模式下,这是相当不错的。不幸的是,即使我在firebase控制台中添加了debug和release 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);
添加了所有三个不同的sha1键,但仍然无法使用:(
我遇到的错误:
正如我所说的,在调试模式下一切正常 但是在发布模式下,启动otp函数后,立即PhineVerificationFailed失败,并显示空消息和空代码。
如果还有什么我想念的,请指教。谢谢大家