Firebase - Adding Additional User Data To Separate DB
I'm new to Firebase and am using the email/password sign-in method. I have the method working fine however on my signup form I have additional fields I want to enter in the databas
Solution 1:
Initialization of firebase object was done for the old version, see this https://firebase.google.com/docs/web/setup , it uses
firebase.initializeApp(config)
instead ofnew firebase()
to update your database with user's additional fields use this code
firebase.database().ref('users/' + user.uid).set({ firstName: firstName, lastName: lastName })
Solution 2:
For updating your database with additional parameters use the below given code and make changes accordingly.
function writeUserData(userId, name, email, imageUrl) {
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
profile_picture : imageUrl
});
}
Post a Comment for "Firebase - Adding Additional User Data To Separate DB"