question

WoutOngena avatar image
0 Votes"
WoutOngena asked LeonLu-MSFT answered

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

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();





dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered

Hello,​

Welcome to our Microsoft Q&A platform!

You can use following code from SO's thread:https://stackoverflow.com/questions/69645770/how-do-i-update-a-users-display-name-in-firebase-in-xamarin

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


Best Regards,

Leon Lu



If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.