Rule definition and structure

Firebase rules provide predefined variables that can be used inside a rule definition:

Name Definition / Usage
auth It represents information of the authenticated user. It will be null for an unauthenticated user. It is an object that contains uid, token, and provider fields and corresponding values.
$ variables It represents wildcard path to refer to the dynamically generated keys and represent IDs.
root It represents data snapshot at the root path in the Firebase database before applying the given database operation.
data It represents the Data Snapshot before applying the given database operation. For example, in case of the update or write, the root represents the original data snapshot without ...

Get Serverless Web Applications with React and Firebase now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.