I am using firebase firestore in my unity project. I did the registration part, but if a user registered with the name of sam, another user can also register with the name of sam. How can I prevent this? (I am using this code)
public void SaveUserData()
{
DocumentReference docRef = db.Collection("users").Document(uname.text);
Dictionary<string, object> city = new Dictionary<string, object>
{
{ "name", uname.text },
{ "email", email.text },
{ "password", password.text },
{ "wallet", wallet.text },
{ "uid", auth.CurrentUser.UserId },
{ "score", 0 },
{ "timestamp", FieldValue.ServerTimestamp }
};
docRef.SetAsync(city).ContinueWithOnMainThread(task => {
Debug.Log("Added data to the LA document in the cities collection.");
PlayerPrefs.SetString("currentUname", uname.text);
SceneManager.LoadScene(1);
});
}