0
我正在使用以下步驟註冊新的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();
}
}
});
是的。這是我最關心的問題。另外,任何向用戶類添加額外參數的方式?喜歡沒有帖子?沒有朋友等? – Zen
在/ users/uid保存關於用戶的所有詳細信息 – Nirel
您能分享一些關於保存用戶詳細信息的代碼嗎? – Zen