Firebase - Update user using FirebaseAdmin in ASP.NET CORE 3.1

Update or Modify user details in firebase using the Firebase Admin SDK in ASP.NET CORE 3.1

September 10, 2020

To update firebase user details first we have to Retrieve user data based on Email Address

UserRecord userRecord = await FirebaseAuth.DefaultInstance.GetUserByEmailAsync("youremail@domain.com");

Now we can Update a user using "Uid" which we will get from user data

UserRecordArgs args = new UserRecordArgs()
{
    Uid = userRecord.Uid,
    PhoneNumber = "+11234567890",
    EmailVerified = true,
    Password = "New Password",
    DisplayName = "Full Name",
    PhotoUrl = "photourl",
    Disabled = false,
};

UserRecord userRecordUpdate = await FirebaseAuth.DefaultInstance.UpdateUserAsync(args);

Note:

1. To reset password you can use the same code mentioned above. Just Remove all other properties except password

2. To know how to create and register user using the firebase admin Click here

3. To know how to delete user using firbase admin Click here

Additional References:

1. https://firebase.google.com/docs/auth/admin/manage-users#c

Post Comments(0)

Leave a reply

Will not be displayed in comment box .

Loading...