注册不带电子邮件地址的Firebase用户
问题描述:
我正在使用以下步骤注册新的Firebase用户。有没有办法让我设置一个username
参数,以便用户在将来可以使用username
& password
登录?注册不带电子邮件地址的Firebase用户
此外,有没有办法只能使用username
& password
注册,也就是说,我不想有电子邮件ID的选项。
我已经通过了以下解决方案,但效率不高。我想有更好的方法。
Firebase login and signup with username
private FirebaseAuth auth;
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
//create user
auth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(SignupActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(SignupActivity.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
// 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()) {
Toast.makeText(SignupActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
} else {
startActivity(new Intent(SignupActivity.this, MainActivity.class));
finish();
}
}
});
答
您可以添加任何域的用户名
背后注册<用户名用户> @ summersApp.com。
请注意,由于Firebase使用电子邮件地址发送密码重设电子邮件,因此用户无法在忘记密码时重置密码。
是的。这是我最关心的问题。另外,任何向用户类添加额外参数的方式?喜欢没有帖子?没有朋友等? – Zen
在/ users/uid保存关于用户的所有详细信息 – Nirel
您能分享一些关于保存用户详细信息的代码吗? – Zen