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

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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.



Got any firebase Question?