How can I add name, profile pic, address of a user to Firebase Database?

Related searches

I m trying to make an Android app in which I want to save each user personal details like name, profile pic, and address to Firebase Database for future use.

Please suggest me how can I do that?

You have not invested time in getting familiar with These Firebase Docs. This is the reason why there are so many down-votes to your question. Still I would like to give you a brief overview of what Firebase gives you:

//This is how you can get the user profile data of each logged in user

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
    // Name, email address, and profile photo Url
    String name = user.getDisplayName();
    String email = user.getEmail();
    Uri photoUrl = user.getPhotoUrl();

    // The user's ID, unique to the Firebase project. Do NOT use this value to
    // authenticate with your backend server, if you have one. Use
    // FirebaseUser.getToken() instead.
    String uid = user.getUid();

//This is how you can update user profile data of each logged in user

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
        .setDisplayName("Jane Q. User")

        .addOnCompleteListener(new OnCompleteListener<Void>() {
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Log.d(TAG, "User profile updated.");

If you you are using firebase without implementing any authentication and security rules then I would say you should change it asap. As without authentication and proper security rules any one can get access of your database and alter it in any manner he/she wants to.

For logged in users you need not do anything extra or special to save their profile details. If you use auth providers like Gmail, Facebook then basic profile info is automatically saved by firebase. If you are using some custom auth method then refer to update user profile code snippet provided by firebase. That's how you save basic user profile.

Do let me know if this helps you.

Manage Users in Firebase, address, a name and a photo URL—stored in the project's user database, that can be You cannot add other properties to the user object directly; instead, you can The first time a user signs up to your app, the user's profile data is If the user signed up with an email address and password, only the� Add Firebase to an app You can update a user's basic profile information—the user's display name and profile photo Set a user's email address. You can set a

I used this code in my project. It works for me. signUp.dart

 onPressed: () {
               email: _email, password: _password).then((signedInUser) {
                   _uid= signedInUser.uid;
                    Map<String,String> userDetails = {'email':this._email,'displayName':this._displayname,'uid':this._uid,
                  }).catchError((e) {



 Future<void> addData(postData,context) async{

Users in Firebase Projects, Learn how to store custom User data within Firebase. users to have custom display names to use in our app (rather than showing the user's email or uid) a string to the ref() function, so firebase.database().ref('users') refers to the users node. We'll be using Gravatar to get profile picture functionality in our application. There are some cases where getCurrentUser will return a non-null FirebaseUser but the underlying token is not valid. This can happen, for example, if the user was deleted on another device and the local token has not refreshed.

Got help from Nishants answer and this is what worked for my current project using Kotlin.

fun registerUser(email: String, password: String, displayName: String) {
        auth.createUserWithEmailAndPassword(email, password)
            .addOnCompleteListener(requireActivity()) { task ->
                if (task.isSuccessful) {
                    // Sign in success, update UI with the signed-in user's information
                    Log.d(TAG, "createUserWithEmail:success")

                    val user = auth.currentUser

                    val profileUpdates =

                        .addOnCompleteListener { task ->
                            if (task.isSuccessful) {
                                Log.d(TAG, "User profile updated.")

                    showAlert("Created your account successfully!")

                } else {
                    // If sign in fails, display a message to the user.
                    Log.w(TAG, "createUserWithEmail:failure", task.exception)

                    showAlert("Authentication failed!")

//                    updateUI(null)

I am creating the user and updating the details right after. showAlert and updateUI are my own functions to show the alertdialog and redirecting the user. Hope this will help someone else in the near future. Happy coding!

Storing User Profiles in Firebase, We are also going to enable the user to Add their Firstname and Lastname, which we are going to store in a document we'll create in the Firestore Database. the user to update their Firstname, Lastname, Phone number and email address. :src="profile.image" @getValue="saveImage" btn-title="upload" I have integrated firebase auth with my android app. Lets say a user has a mail I want to add some extra information to the user like the name of the user, occupation and address.

How to update Firebase Authentication Profile, Firebase Console: Add Firebase to Firebase Firestore Duration: 11:24 Posted: Oct 12, 2019 You need to create that database users child node yourself ;-). The createUserWithEmailAndPassword function only creates a new user in Firebase authentication service. The database itself isn't changed at all as a result.

Firebase, Just to update because I spent sometime to find this answer, getDownloadUrl() is NOT a function of taskSnapshot anymore. So in order to get the image URL from Firebase Storage you need to add a listener to taskSnapshot.getMetadata().getReference().getDownloadUrl()

For now I'm only doing the Auth with an email and password, then I click register and the user is created in the Auth section in the Firebase console. But I also want my users to be added in the database. I want to add more fields (such as name, address etc) which will be stored in the users database in Firebase.

  • @KiranBennyJoseph yes firebase is for storing your data there is cloud for firebase
  • ok. it is my bad.
  • Thank you soooooo much for this -- this got me working after hours of hassle -- thank you :)
  • This is great for Name, email and profile picture but how would I go about saving further details such as address, account level, date of birth etc?