I'm at an impasse on this. I'm trying to create a user with AngularFire using $firebaseAuth NOT the deprecated FirebaseSimpleLogin, as recommended in the docs. I am certain that the form submits a valid email and password, but I continue to get the following error in the console:
Error: Firebase.createUser failed: First argument must contain the key "email" with type "string"
You can see the code, I use a factory service to handle the $createUser method, which is where the error is occurring because the subsequent console.logs are not firing once the method returns. Please note, I have also tried using the boilerplate code in the docs rather than splitting it between controller and services and have received the same error. Your assistance is greatly appreciated, thanks!
ng-submit="register()" on Form element
$scope.register = function(){
console.log($scope.user); // logs object correctly
// Authentication is passed into the controller as a dependency
Authentication.register($scope.user)
.then(function(){
//This does NOT fire
console.log("User created successfully!");
Authentication.login($scope.user);
})
.then(function(authData){
console.log("Logged in as:", authData.uid);
})
.catch(function(error) {
console.log('error');
$scope.errorMessage = error.toString();
});
};
Authentication factory service
var obj = {
register: function(user){
var obj = {email: user.email, password: user.password};
console.log(obj); // works correctly
//var auth has the reference to Firebase
return auth.$createUser(obj);
}
};