signInWithEmailAndPassword()
始终返回“没有与此电子邮件ID对应的用户记录”,但是我可以在Firebase控制台中看到电子邮件和密码,其他登录方法可以正常工作,有人可以找到解决方案
我的代码:-
FirebaseAuth.getInstance().signInWithEmailAndPassword(Email, Password)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
try {
CommonMethods.dismissDialog(getActivity());
if (task.isSuccessful()) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user == null) {
CommonMethods.customeAlertThinkly(getActivity(), "Oops!", "Please Register with Thinkly and then try to signIn.", "Ok", "nointernet");
}
if (user != null) {
if (user.isEmailVerified()) {
if (task.isSuccessful()) {
loginEmail(Email);
}
} else {
CommonMethods.customeAlertThinkly(getActivity(), "Oops!", "Your email or pen name is invalid. If you are a new user, please ensure you sign up with a valid email and verify the email before signing in.", "Ok", "nointernet");
}
}
} else {
String errorCode = "";
if (((FirebaseAuthException) task.getException()) != null) {
errorCode = ((FirebaseAuthException) task.getException()).getErrorCode();
}
if (errorCode == null) {
return;
}
switch (errorCode) {
case "ERROR_INVALID_CREDENTIAL":
CommonMethods.customeAlertThinkly(getActivity(), "Oops!", "The supplied auth credential is malformed or has expired.", "Ok", "nointernet");
break;
case "ERROR_USER_NOT_FOUND":
CommonMethods.customeAlertThinkly(getActivity(), "Oops!", "There is no user record corresponding to this email Id", "Ok", "nointernet");
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
});