很抱歉,我的问题很愚蠢,但我在Flutter应用中使用了Firebase电话身份验证,但有时它会呼叫我的电话,而不发送OTP SMS。你们是否经历过类似的事情或Firebase电话身份验证?我只希望他们将短信发送到我的手机,我们可以选择执行此操作吗?感谢大伙们。我的电话身份验证代码。
class AuthHelper {
static String finalVerificationId;
static final FirebaseAuth auth = FirebaseAuth.instance;
static final PhoneVerificationCompleted verificationCompleted =
(AuthCredential phoneAuthCredential) {
auth.signInWithCredential(phoneAuthCredential);
};
static final PhoneVerificationFailed verificationFailed =
(AuthException authException) {
return authException.message;
};
static final PhoneCodeSent codeSent = (String verificationId, [int forceResendingToken]) async {
finalVerificationId = verificationId;
print('codeSent ==> $finalVerificationId');
return verificationId;
};
static final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
(String verificationId) {
finalVerificationId = verificationId;
print('codeAutoRetriveal ==> $finalVerificationId');
return verificationId;
};
static Future verifyPhoneNumber(String phoneNumber) async {
await auth.verifyPhoneNumber(
phoneNumber: phoneNumber,
timeout: const Duration(seconds: 60),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout).then((_){
print('success');
}).catchError((e){
print(e);
});
}
}