Firebase电子邮件和密码身份验证失败,即使我已在Firebase控制台中激活它,该活动的代码来自github示例。
此外,我手动添加了一个用户,所以一切都在那里。
我正在做这个链接描述:Firebase instructions
更新
以下是签名方法的代码:
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithEmail", task.getException());
Toast.makeText(EmailPasswordActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// [START_EXCLUDE]
hideProgressDialog();
// [END_EXCLUDE]
}
});
更新2
我也试过这样做,我也不工作:
private void signInBeta(String email,String password){
Firebase ref = new Firebase("https://prechecker-46a58.firebaseio.com/");
ref.authWithPassword(String.valueOf(email), String.valueOf(password), new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
System.out.println("User ID: " + authData.getUid() + ", Provider: " + authData.getProvider());
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
System.out.print("\nSOMETING WENT WRONG\n");
}
});
}
这可能是因为您没有启用oAuth进行登录。 尝试在https://console.developers.google.com/apis/credentials中添加OAuth客户端ID?
如果电子邮件ID不是电子邮件ID格式,并且不接受长度较短的密码,则Firebase不接受。我的问题也是一样的,但解决方案似乎对你来说意义不大。我希望这可以帮助你。在提供电子邮件和密码时,请确保电子邮件ID具有“@ domain.com”,例如“[email protected]”,并且您的密码必须至少为10。
如果您使用虚拟设备运行应用,请检查Google服务是否是最新的,或者切换到包含所有更新的个人设备。
我花了一整天时间想弄清楚,结果你需要6+的密码长度