3

There is no user record corresponding to this identifier. The user may have been deleted.

export const createEmployee = ({ email, password}) => {
  return (dispatch) =>{`
    firebase.auth().createUserWithEmailAndPassword ( email,password )
    .then(
      firebase.auth().signInWithEmailAndPassword( email,password )
      .then(Actions.profile())
    )
  };
};
KENdi
  • 7,576
  • 2
  • 16
  • 31
Karki Ashok
  • 33
  • 1
  • 4

1 Answers1

6

According to the official documentation, after the success of createUserWithEmailAndPassword the user is automatically signed-in.

Create a new account by passing the new user's email address and password to createUserWithEmailAndPassword:

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});

If the new account was created, the user is signed in automatically. Have a look at the Next steps section below to get the signed in user details. [...]

Look also at this SO question.

So in your promise you can just get you already authenticated user like that:

var user = firebase.auth().currentUser;

No need to make signInWithEmailAndPassword call.

shadowsheep
  • 14,048
  • 3
  • 67
  • 77