I'm stuck on this issue. I'm attempting to set up a user with AngularFire using $firebaseAuth instead of the deprecated FirebaseSimpleLogin, as advised in the documentation. I am confident that the form is submitting a valid email and password, but I keep receiving the following error in the console:
Error: Firebase.createUser failed: First argument must contain the key "email" with type "string"
You can view the code below. I am using a factory service to handle the $createUser method, and the error seems to be happening within that function as the subsequent console logs are not being triggered after the method returns. I have also tried using the code provided in the documentation without splitting it between controller and services, but I still encounter the same error. Any help would be greatly appreciated. Thank you!
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);<br>
})
.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);
}
};