Task.isSuccessful()为false,无法添加任何用户

时间:2016-09-16 13:30:15

标签: android firebase firebase-realtime-database firebase-authentication

FirebaseAuth.AuthStateListener mAuthListener;
private FirebaseAuth mAuth;
EditText name, email, password;
Button submit;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.signup);
    mAuth = FirebaseAuth.getInstance();
    mAuthListener = new FirebaseAuth.AuthStateListener() {
    @Override
    public void onAuthStateChanged(@NonNull FirebaseAuth    firebaseAuth) {
        FirebaseUser user = firebaseAuth.getCurrentUser();
        if (user != null) {
            // User is signed in
            Log.d("########", "onAuthStateChanged:signed_in:" + user.getUid());
        } 
        else{
             // User is signed out
             Log.d("########", "onAuthStateChanged:signed_out");
        }

     }
  };


 name = (EditText) findViewById(R.id.input_name);
 email = (EditText) findViewById(R.id.input_email);
 password = (EditText) findViewById(R.id.input_password);
 submit = (Button) findViewById(R.id.btn_signup);
 submit.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {

  mAuth.createUserWithEmailAndPassword(email.getText().toString(),  password.getText().toString()).addOnCompleteListener(SignUp.this, new OnCompleteListener < AuthResult > () {
   @Override
   public void onComplete(@NonNull Task < AuthResult > task) {
       Log.d("###########", "signInWithEmail:onComplete:" +       task.isSuccessful());

 }
});

Task.isSuccessful()始终返回false,我无法添加任何用户。

我在Firebase上启用了电子邮件身份验证,并且能够从伪造本身添加用户,我无法进行调试并找出问题所在。

已完成所有其他设置,例如添加依赖项并将从Firebase获取的配置文件复制到app目录中。请帮忙。

2 个答案:

答案 0 :(得分:1)

User Creation. Showing the required length of password

我遇到了同样的问题,并决定从firebase控制台创建一个用户。然后出现图像中显示的错误。密码长度至少为6个字符。注册新用户时,请确保密码长度至少为6,并且应该有效。

答案 1 :(得分:0)

我附加了addOnFailureListener()并滥用:

该Firebase项目已禁用给定的登录提供程序。在Firebase控制台的“身份验证”部分的登录方法标签下启用该功能。

>>> list(itertools.filterfalse(lambda x: not (10 <= x <= 20), nums))
[10, 11, 15, 19, 20]