title: firebase - Create user with email and password returns undefined uid
body: <p>I'm currently working on a function in firebase that creates users without logging them in, following a tutorial here on this website. (I decided not to follow the firebase-admin way of adding users due to lack of time). My current problem is when i execute the <code>CreateUserWithEmailAndPassword</code> method, it's promise does not work, and does not give a uid at all. The users are also not registering at all. Here is my code used for this:</p>
  
  <pre><code>var otherApp = firebase.initializeApp({
      apiKey: "AIzaSyDXS11uOZGDmHYuN3J8BJxOG_9vanNakqA",
      authDomain: "pasigueno-assist-1532249634197.firebaseapp.com",
      databaseURL: "https://pasigueno-assist-1532249634197.firebaseio.com",
      projectId: "pasigueno-assist-1532249634197",
      storageBucket: "pasigueno-assist-1532249634197.appspot.com",
      messagingSenderId: "394982410129"
    }, "other");
  
  otherApp.auth().createUserWithEmailAndPassword(username, password).then(function (user) {
      var uid = user.uid;
      var fullnames = fullname.value;
      var barangays = barangay.value;
      var status = "Active";
      var addresss = address.value;
      var userTypes = userType.value;
      var rootRef = firebase.database().ref();
      var storesRef = rootRef.child('users');
      var newStoreRef = storesRef.push();
      newStoreRef.set({
          Address: addresss,
          Name: fullnames,
          Barangay: barangays,
          Username: username,
          UserType: userTypes,
          UserID: uid,
          Status: status
      });
      otherApp.auth().signOut();
      console.log("ok");
  }, function (error) {
      console.log(error);
      otherApp.auth().signOut();
  });
  </code></pre>
  
  <p><code>var otherApp</code> works as my secondary ref to avoid being kicked out of firebase when signing in regularly.</p>