Home > OS >  How do I update a users display name in firebase in Xamarin?
How do I update a users display name in firebase in Xamarin?

Time:10-22

After creating a user in Xamarin using firebase:

await FirebaseAuth.Instance.CreateUserWithEmailAndPasswordAsync(email, password);

I want to update their display name so that when I sign them in I can just get it from what the sign in method returns. I have tried the following but it does not seem to work, What is the right way to do this?

var changeRequest = user.User.ProfileChangeRequest();
changeRequest.DisplayName = username;
await changeRequest.CommitChangesAsync();    
await firebaseUserInfo.UpdateProfileAsync();

CodePudding user response:

fixed it by using this:

firebaseUserInfo = FirebaseAuth.Instance.CurrentUser;
                UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder().SetDisplayName(username).Build();
                await firebaseUserInfo.UpdateProfileAsync(profileUpdates);
  • Related