user signs in. I make a call to create new user with
firebase.auth().createUserWithEmailAndPassword(email, password)
it successfully creates new firebase user. Before this call firebase.auth().currentUser.uid gives different uid then after the call. So active user changes.
Is there any way for active user create another user and still be active user?
I know one way to work this around:
Save user's email & password to memory and after creating user re-login back to original user, but it requires saving password and i don't like it.
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(user => {
// login back to main account
firebase.auth().signInWithEmailAndPassword(current_user_email, current_user_password).then(original_user => {
const userRef = firebase.database().ref().child(`users/${user.uid}`);
userRef.set({
...