How to use the Firebase Database to keep a list of Firebase Authentication users – How to save user profile data

Every authenticated user has a Firebase uid that’s unique across all providers and is returned in the result of every authentication method.

A good way to store your user’s data is to create a node to keep all the users’s data and to protect it using your security rules

– Database

{
   "users": {
      "uid1" : {
         "name": "Steve",
         "surname": "Jobs"
      },
      "uid2" : {
         "name": "Bill",
         "surname": "Gates"
      }
   }
}

– Security

{
    "rules": {
        "users": {
            "$uid": {
                // If node's key matches the id of the auth user
                ".write": "$uid == auth.uid"
            }
        }
    }
}

The $uid in the above rules is a so-called "dollar variable", which ensures that the rules under it are applied to all child nodes of users. For more information see the documentation on Using $ Variables to Capture Path Segments.

if you want to reproduce, please indicate the source:
How to use the Firebase Database to keep a list of Firebase Authentication users – How to save user profile data - CodeDay