Information that is given below is straight from Firebase website.
{
  "rules": {
    "users": {
      "$user": {
        ".read": "auth.uid === $user",
        ".write": "auth.uid === $user"
      }
    }
  }
}
When a client tries to access /users/barney, the $user default location will match with $user being equal to "barney". So the .read rule will check if auth.uid === 'barney'. As a result, reading /users/barney will succeed only if the client is authenticated with a uid of "barney".
Firebase is good at documenting, but I didn't find any deep discussion about using "==" or "===". As long as I know it works like how JavaScript does.
According to their documentation
if auth.uid === 'barney'. As a result, reading /users/barney will succeed only if the client is authenticated with a uid of "barney".
Sometimes I've seen
"$user": {
        ".read": "auth.uid == $user",
        ".write": "auth.uid == $user"
 }
So my question is which one is the right way to do it? What is happening when we use "==" and "===" in rules?
 
     
    