I am trying to save FullName and Profile Picture while signing up to firebase but after SignIn it returns null the user.displayName and user.photoURL values. I tried as below, this is how firebase docs show. (New version of firebase authuser.user.update()
doesn’t work. )
const signUp = () => {
createUserWithEmailAndPassword(auth, email, password).then((userCredential) => {
const user = userCredential.user;
user.email = email
user.displayName = name;
user.photoURL = photo;
}).catch((error) => {
const errmessage = erro.message;
alert(errmessage);
})
navigation.navigate("Home")
}
2
Answers
I solve the problem with
updateProfile(user, {displayName: name, photoURL: photo})
Now it keeps the FullName and Photo even after logout.
Here is my fullcode:
Perhaps you should move your user creation to a backend server, you can use firebase cloud functions and use Firebase Admin to create and manage your users. You’ll have much more control on user managemen.
With Admin SDK you can create a new user as shown below:
Hope this helps you.