Skip to content Skip to sidebar Skip to footer

How To Store Data In Firebase Along With Authentication Data

I have integrated Firebase Authentication with Android App. Now I have to store other app related data like user extended profile, user preferences, settings etc. According to Fire

Solution 1:

Yes, this is the correct approach. If you are using firebase authentication to sign in a user using email for example, then you have to use firebase realtime database to be able to store other information related to the user example:

Usersuseridname:userxemail:userx@gmail.comage:102userid1name:useryemail:usery@gmail.comage:200

To be able access the instance of the database with child node Users you can do this:

 DatabaseReference ref=FirebaseDatabase.getInstance().getReference().child("Users");

Or this:

FirebaseDatabase database = FirebaseDatabase.getInstance(); 
DatabseReference ref=database.getReference().child("Users");

No need to write the name of the database inside the getReference("<name here>");. This was needed in the old versions but it is not needed now.

Post a Comment for "How To Store Data In Firebase Along With Authentication Data"