I'm working on an app and I want to achieve this. When an user signing in I want to get his username and photoURL and store in firebase.
handleSubmit=(event)=>{
event.preventDefault();
if(this.isFormValid()){
this.setState({errors:[],loading:true});
firebase
.auth()
.createUserWithEmailAndPassword(this.state.email,this.state.password)
.then(createdUser =>{
console.log(createdUser);
createdUser.user
.updateProfile({
displayName:this.state.username,
photoURL:`http://gravatar.com/avatar/${md5(createdUser.user.email)}?d=identicon`
})
.then(()=>{
this.saveUser(createdUser).then(()=>{
console.log('user saved');
});
})
.catch(err=>{
console.log(err);
this.setState({errors:this.state.errors.concat(err),loading:false});
})
})
.catch(err=>{
console.error(err);
this.setState({errors:this.state.errors.concat(err),loading:false})
})
}
}
Can anyone have any idea about why I get this error?

