so it seems that i cant directly get the user.uid upon creating a user or its not implemented in the documents. I have tried this chunk of code below to no avail as authdata returns as empty. is there a workaround?
NOTE: wherever you see Authentication its a factory that returns the working code to create a user or login a user using createUser() or $authWithPassword accordingly.
$scope.register = function (){
Authentication.register($scope.user)
.then(function(user){
var ref = new Firebase (FIREBASE_URL + 'users');
var firebaseUsers = $firebaseAuth(ref);
ref.$authWithPassword({
email: $scope.user.email,
password: $scope.user.password
})
.then(function(authData){
var userInfo = {
regUser: authData.uid,
date: Firebase.ServerValue.TIMESTAMP,
firstname: $scope.user.firstname,
lastname: $scope.user.lastname,
email: $scope.user.email
}
firebaseUsers.$set(regUser,userInfo);
});
Authentication.login($scope.user);
})
.then(function(user){
$timeout(function(){
$location.path('/meetings');
}, 2000);
})
.catch(function(error){
$scope.message = error.toString();
});
} //register
i have seen this response but doesnt seem to apply using it with angularfire
ref.createUser({
email: '...',
password: '...'
}, function(err, user) {
if (!err) {
console.log('User created with id', user.uid);
}
});
any examples that work with angular version?