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?
CodePudding user response:
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
// ...
});