我正在尝试将电子邮件身份验证与电话身份验证相关联,但我收到错误“java.lang.IllegalArgumentException:无法在没有verifyProof,sessionInfo,ortemprary证明的情况下创建PhoneAuthCredential”找到我的代码以链接下面的两个身份验证提供程序。请指出我正确的方向
// [START sign_in_with_phone]
private void linkWithCredential() {
final PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId,mVerificationField.getText().toString());
firebaseauth.getCurrentUser().linkWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Log.d(TAG, "linkWithCredential:success");
FirebaseUser user = task.getResult().getUser();
updateUI(user);
} else {
Log.w(TAG, "linkWithCredential:failure", task.getException());
Toast.makeText(Phone_Auth.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
}
}
});
}
// [END sign_in_with_phone]
答案 0 :(得分:0)
我解决了问题,但忘了在此处发布答案了,解决方法代码=
private void linkWithCredential(AuthCredential credential) {
firebaseauth.getCurrentUser().linkWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "linkWithCredential:success");
FirebaseUser user = task.getResult().getUser();
updateUI(user);
} else {
Log.w(TAG, "linkWithCredential:failure", task.getException());
Toast.makeText(Phone_Auth.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
}
}
});
}