Question

Let's say I've created a fresh Email / Password user for my Firebase collection called bob@example.com

How do I now limit the write access to anything in that collection to specifically this user?

{
  "rules": {
    ".read": true,
    ".write": false
  }
}

...?
Was it helpful?

Solution

You might have to get a bit more specific to get anything more helpful than the security rules documentation. But to answer your question, let's say you wanted to limit your entire Firebase write access to Bob:

{
  "rules": {
    ".read": true,
    ".write": "auth.email == 'bob@example.com'"
  }
}

Let's say you want to restrict an item collection in your Firebase just to Bob:

{
  "rules": {
    ".read": true,
    "items": {
      ".write": "auth.email == 'bob@example.com'"
    }
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top