Reputation: 1807
Trying to follow the Firebase doc to update the photoURL of users. However, when I update, it only returns null.
editProfilePicture(){
const user = firebase.auth().currentUser;
user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
}
I render the image using a component that takes the return of photoURL <ProfilePicture image={currentUser && currentUser.photoURL} />
.
currentUser is const { currentUser } = firebase.auth()
, and this works perfect for displayName
..
What am I doing wrong?
Upvotes: 2
Views: 1523
Reputation: 1246
if you using google auth it will works fine but if you using just email and password auth it couldn't return the user profil(null) because you just initialize email and password by your own, your app just borrow your email.
Upvotes: 3