I am creating a new user with anglerfire but when I sign the user, And ask for the last name and I add that information after registration.
$ firebaseSimpleLogin (fbRef). $ CreateUser ($ scope.signupData.email, $ Scope.signupData.password) .then (function (user) {// current user $ add firebase (additional information for fbRef.child ('users'). Id) .child ("name"). $ Set ({first: $ scope.signupData.first_name, last: $ scope.signupData.last_name}) then (function () {$ rootScope.user = user;}) }};
The above code works, this node finishes fire (user / user.id/ ...).
Problem < / Strong>
When I login with a new user, Get the default information: id, email, uid, etc. But no name. How can I automatically associate that data with the user?
You can not ignore the complexity of firebase login management by storing login details in your own datastore. This process does not know anything from your app's forge, which means that It does not know where you or any additional user Collecting data is given by this data which it knows as the facility (id, uid, email, md5_hash, provider, firebugs and tokens).
It depends on your app that you take the [u] ID and whatever app takes specific user information (like first name, last name). For an angular app, you want to get a UserProfile service that retrieves the data you find, once you get the certification success broadcast
In addition, change your snippet, Consider
.child (user.id)
to
.child (user.uid) / Code>
If you ever support Facebook / Twitter / Persona authentication later, then it would be easy. The UID looks like "simple login: 1" - it is probably not possible in providers, but the possible ID helps avoid conflicts.
Comments
Post a Comment