Firebase database, make auth uid the default id of a document
How can I make the generated uid from auth 's createUserWithEmailAndPassword(email, pass) be the uid of document? I have this code as a signup function : $scope.signup = function (user) { auth.createUserWithEmailAndPassword(user.email, user.password) .then(ok => { // remove pass before saving delete user.password; // assigning the uid user.uid = ok.uid; // saving to userRef = ...ref().child('/accounts') userRef.push(user) .then(snap => console.log(snap)) .catch(err => console.log(err)); }) .catch(e => console.log(e.message)); } The code above does what is expected, the output is here So data