Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to change the firebase username and profile picture?

So i have firebase authentication setup but when i use createUserWithEmailAndPassword() it does create the user but what about the User Name/ Display Name? or the profile picture?

Is it possible to change the user name or profile picture in firebase?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes, you’re able to change the username, profile picture and more in firebase.

Firebase has an example in the docs
https://firebase.google.com/docs/auth/web/manage-users#update_a_users_profile

So if you wanted to change the username or profile picture you would have to use the updateProfile method

import { getAuth, updateProfile } from "firebase/auth";
const auth = getAuth();
updateProfile(auth.currentUser, {
//Replace "Jane Q. User" to the username you desire
//And Replace the PhotoURL with the desired Image
  displayName: "Jane Q. User", photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(() => {
  // Profile updated!
  // ...
}).catch((error) => {
  // An error occurred
  // ...
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading