我一直在发布使用Firebase电话号码身份验证的android应用程序,当该应用程序处于调试模式时,一切正常,但在发布模式下,电话号码身份验证会引发以下异常
com.google.firebase.FirebaseException:发生内部错误。 [DEVELOPMENT_MODE_MISMATCH:开发模式要求中提供的非开发模式验证证明。 ]
代码是
String phoneNumber = getPhoneNumber();
loginProgress.setVisibility(View.VISIBLE);
// send verification sms
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber,
60,
TimeUnit.SECONDS,
this,
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
// when auto verification happens
// sign-in
mFirebaseAuth.signInWithCredential(phoneAuthCredential)
.addOnSuccessListener(LogInActivity.this, loginListener).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("Exception",e.getMessage());
}
});
}
@Override
public void onVerificationFailed(FirebaseException e) {
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// when the user enter invalid number
mPhoneLayout.setError(getString(R.string.wrong_phone_number));
mPhoneLayout.setErrorEnabled(true);
} else if (e instanceof FirebaseTooManyRequestsException) {
// The SMS quota for the project has been exceeded
// when free sms limitation is reached
}
}
@Override
public void onCodeSent(final String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
showVerificationDialog(verificationId);
}
}
);
答案 0 :(得分:0)
请在Github上检查以下问题。根据最新评论,问题已解决:
https://github.com/firebase/firebase-admin-node/issues/405
我尚未测试最新版本,但是如果您尝试使用phoneNumber
作为该字段之一来修补列入白名单的电话号码,firebase会抛出此错误。