I am finding it difficult to save displayName and photoURL of user to firebase during sign-up in my react native project.
I am using the docs(https://firebase.google.com/docs/reference/js/firebase.User.html#updateprofile) as a guide.
See below my code:
onRegister = () => {
firebase.auth().createUserWithEmailAndPassword( this.state.typedEmail, this.state.typedPassword)
.then((userCredentials) => {
if(userCredentials.user) {
console.warn(userCredentials.user)
userCredentials.user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
})
.then(() => {
this.setState({ user: userCredentials.user })
console.warn("yo:", this.state.user)
})
}
}).catch((error) => {
console.warn(`error:, ${error}`)
})}
With the above function I can save the email and password but the displayName and photoURL still returns null.
Please help.