Reputation: 936
creating a login app in AngularJS with firebase, and getting these issues.
1 .TypeError: auth.$createUser is not a function
- Error: permission_denied: Client doesn't have permission to access the desired data.
var app = angular.module('weatherApp',
['ngRoute', 'firebase'])
.constant('FIREBASE_URL', 'https://weatherapp-9a183.firebaseio.com');
app.controller('registerController',
['$scope', '$firebaseObject', 'FIREBASE_URL', function ($scope, $firebaseAuth, FIREBASE_URL) {
var ref = new Firebase(FIREBASE_URL);
var auth = $firebaseAuth(ref);
auth.$createUser({
email: "[email protected]",
password: "123"
});
}]);
Upvotes: 0
Views: 392
Reputation: 1420
Use latest version of firebase and angularfire.
In order to create a new user with email and password, you should use createUserWithEmailAndPassword method specified in the link. Code like below.
var auth = $firebaseAuth();
auth.$createUserWithEmailAndPassword("[email protected]","123").then(function(){
console.log("Successfully Created") or alert("Successfully Created");
//Once user is created you can see it in the Authentication (Users) tab.
}).catch(function(err){
console.log(err) or alert(err)
});
I don't know what your trying accomplish here.But to my best knowledge this is the way to create a new user using $firebaseAuth.
Upvotes: 1