Reputation: 3709
I've been pouring over Firebase's Docs trying to register a user. I'm using Angular 1.3 and Firebase 1.0.24.
I simply want to create a user.
Here are my Firebase rules:
{
"rules": {
".read": true,
".write": true
}
}
My markup saves a user successfully to $scope.user ($scope.user.email and $scope.user.password).
In my controller, I have the following:
angular.module('app')
.controller('RegisterCtrl', ['$scope','$firebase', 'RegisterFactory',
function ($scope, $firebase, RegisterFactory) {
$scope.submit = function() {
RegisterFactory.Register($scope.user);
}
};
}]);
The controller sends the $scope.user info to the RegisterFactory, which is as follows:
angular.module('app')
.factory('RegisterFactory', ['$firebase', function($firebase) {
return {
Register: function(user) {
var ref = new Firebase('https://[redacted].firebaseio.com');
ref.createUser({
email: user.email,
password: user.password
}, function(error) {
if (error === null) {
console.log('User created!');
} else {
console.log('Error creating user', error);
}
});
}
};
}]);
When I enter info in the input fields and submit to register the user, I receive the following error:
TypeError: undefined is not a function at Object.Register
and it points to the factory line 13:10 which is:
ref.createUser({
I know that Firebase Simple Login has been deprecated and that Firebase now carries Authorization functionality, but I can't figure out what I'm doing wrong. I'm following this portion of Firebase's Docs: https://www.firebase.com/docs/web/guide/login/password.html
Any help is appreciated.
Upvotes: 0
Views: 883
Reputation: 465
With Firebase 1.0.24 you need to use the Firebase Simple Login library.
You can find the documentation on Github: https://github.com/firebase/firebase-simple-login/blob/master/docs/v1/api.md
The documentation you're referring is for the latest Firebase release.
Upvotes: 3