com.google.firebase.FirebaseException:发生内部错误。 [USER_NOT_FOUND] [英] com.google.firebase.FirebaseException: An internal error has occurred. [ USER_NOT_FOUND ]

查看:316
本文介绍了com.google.firebase.FirebaseException:发生内部错误。 [USER_NOT_FOUND]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用电子邮件和密码实现了Firebase身份验证,这里是我的代码
$ b $ pre $ mFirebaseAuth.createUserWithEmailAndPassword(edtEmail.getText()添加新的OnCompleteListener< AuthResult>(){
@Override
public void onComplete(@NonNull Task< AuthResult> task){
if(task.isSuccessful()){
FirebaseUser user = task.getResult()。getUser();
Toast.makeText(RegisterActivity.this,User registered successfully+ user.getEmail (),Toast.LENGTH_SHORT).show();

user.sendEmailVerification()。addOnCompleteListener(new OnCompleteListener< Void>(){
@Override $ b $ public void onComplete @NonNull Task< Void>任务){
if(task.isSuccessful()){
光洁度();
Log.e(RegisterActivity,onComplete:+ task.getResult()。toString());
} else
Log.e(RegisterActivity,onComplete:+ task.getException()。toString());
}
});
} else {
Toast.makeText(RegisterActivity.this,task.getException()。toString(),Toast.LENGTH_SHORT).show();
}

}
});

成功注册后,我向用户发送确认邮件,但收到此错误消息。

  com.google.firebase.FirebaseException:发生内部错误。 [USER_NOT_FOUND] 

我也在firebase中检查过,我的用户已注册,但不知何故,我无法发送确认邮件。

解决方案

我使用Firebase 9.6.1复制并运行了您的代码。当我将一个电子邮件地址传递给以前从未使用过的 createUserWithEmailAndPassword()时, sendEmailVerification()成功完成。我观察到当我为之前创建并在Firebase控制台上删除的用户使用电子邮件地址时报告的失败。当您使用之前使用过的地址然后删除时,您是否看到了失败?



请注意, createUserWithEmailAndPassword()不仅创建用户,而且如果成功的话,用户也可以签名。当创建和登录发生在存在已经登录的用户的时候,似乎有一个与注销和清除前一个用户的缓存相关的Firebase bug。 / p>

我可以通过调用 signOut() createUserWithEmailAndPassword()之前。

I have implemented Firebase authentication with email and password, here is my code

mFirebaseAuth.createUserWithEmailAndPassword(edtEmail.getText().toString(), edtPassword.getText().toString()).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                if (task.isSuccessful()) {
                    FirebaseUser user = task.getResult().getUser();
                    Toast.makeText(RegisterActivity.this, "User registered successfully " + user.getEmail(), Toast.LENGTH_SHORT).show();

                    user.sendEmailVerification().addOnCompleteListener(new OnCompleteListener<Void>() {
                        @Override
                        public void onComplete(@NonNull Task<Void> task) {
                            if (task.isSuccessful()) {
                                finish();
                                Log.e("RegisterActivity", "onComplete: " + task.getResult().toString());
                            } else
                                Log.e("RegisterActivity", "onComplete: " + task.getException().toString());
                        }
                    });
                } else {
                    Toast.makeText(RegisterActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show();
                }

            }
        });

After getting registered successfully i am sending confirmation mail to user, but getting this error.

com.google.firebase.FirebaseException: An internal error has occurred. [ USER_NOT_FOUND ]

I have checked it in firebase also, my user is registered and it is available there, but somehow i am not able to send confirmation mail.

解决方案

I copied and ran your code with Firebase 9.6.1. When I passed an email address to createUserWithEmailAndPassword() that had never been used before, sendEmailVerification() completed successfully. I observed the failure you reported when I used an email address for a user that I had previously created and then deleted at the Firebase console. Are you seeing the failure when you use addresses you have used before and then deleted?

Note that createUserWithEmailAndPassword() not only creates the user, but also, if successful, signs the user in. When the creation and sign-in occurs when there is an existing signed-in user, there appears to be a Firebase bug related to signing out and clearing the cache for the previous user.

I was able to make your code work for a previously signed-in and later deleted user by calling signOut() before createUserWithEmailAndPassword().

这篇关于com.google.firebase.FirebaseException:发生内部错误。 [USER_NOT_FOUND]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆