$createUser promise not returning user object
I'm trying to create a new user, then grab the uid so that I can save additional user data during registration. I'm finding that there is no user object being returning as per the doco in https://github.com/firebase/angularfire/blob/master/src/FirebaseAuth.js.
Here is my Authentication service...
myApp.factory('Authentication',
function($firebaseAuth, FIREBASE_URL, $location) {
var ref = new Firebase(FIREBASE_URL);
var authObj = $firebaseAuth(ref);
var myObj = {
register: function(user) {
return authObj.$createUser(user.email, user.password)
.then(function(authData) {
console.log(authData); // returns undefined
});
},
login: function(user) {
return authObj.$authWithPassword({
email: user.email,
password: user.password
});
},
logout: function() {
return authObj.$unauth();
}
}
return myObj;
});
This update which returns the uid has not yet been deployed. It should be going out very soon. The official documentation is here.
Any news on when this might be deployed?
We are putting the finishing touches on 0.9.1 today. I would expect it to go out tomorrow or maybe even later today if things go well.
Excellent! I look forward to it :)
Any news on when this release will be happening?
We are waiting for an upcoming release of the Firebase JS client in order to get in the new $changeEmail() method. I expected it to get released before the holidays, but that unfortunately didn't happen. Due to a lot of the team being on vacation and this not being a great time to release an update, I would expect the JS client to go out in the first week of January and AngularFire will got out right after. Thanks for your patience.
This seems to affect both, legacy Simple Login and the new built-in Firebase Auth.
Hopefully this is going to be fixed in the next few days. This feature is rather useless without user object being returned.
Seems fixed now.
Yes, as of AngularFire 0.9.1 (which was released yesterday), the $createUser() method now returns a user object containing the uid of the created user. Please upgrade to AngularFire 0.9.1 or later if you need this functionality.
I have still not been able to get the userData back from the $createUser method. I am using the cdn to import code into my project and I have Firebase version 2.0.4 and AngularFire 0.9.1. I have a simple controller which has the example code from the docs pretty much exactly copied and pasted. After successfully creating a user console log reports "cannot read property 'uid' of undefined"
The user data was not exposed from the Firebase client until version 2.0.5 (here is the full changelog for the client). Just upgrade your Firebase version and you'll be all set. The latest version (which is 2.1.1 as of this comment) is fully compatible AngularFire 0.9.1 so I'd suggest upgrading to that.
That was it, thanks jwngr! I used 2.0.5 that did it.