I have a problem to AngularFireAuth.auth.createUserWithEmailAndPassword()
Each time I call this method current user change to the created user.
I have firebase database rules like:
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid == '`<uid user>`'"
}
}
so if i create a firebase auth user and then i create an item on the current firebase database obviously is denied 'cause de new user does not have the correct permissions.
I have this code:
this.afAuth.auth.createUserWithEmailAndPassword( email, 'password' )
.then( () => {
this.firebaselist.set( id ) , {
data: data
}).then( () => console.log( 'user added' ) )
.catch( ( error ) =>{
console.log(error);
} );
} )
.catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;
console.log( error );
});
}