I want to create a user that will be able to authenticate in firebase and then to insert the user's data in the database. The code i am using is the following:
this.app.auth().createUserWithEmailAndPassword(userForm.value.email, userForm.value.password)
.then(res => {
console.log('2 form data:', userForm.value);
this._firebase.app.database().ref('users').push({
email: userForm.value.email,
uid: res.uid
})
})
.catch(err => {
console.log('Something went wrong:', err.message);
});
i am using app
to insert the user in authentication
and _firebase
to insert the user's data to database
. The createUserWithEmailAndPassword
works but i get the following error:
Reference.push failed: first argument contains undefined in property 'users.email'
userForm
contains the user data. What could be wrong?