I am using email/password auth option of Firebase Simple Login.
I store my users\' data with escaped emails as keys, where \'.\' characters have been replaced with \',\'
Update:
If you're using Firebase Simple Login email / password authentication, it is recommended that you key users based upon the uid
field, which will not change and is unique across all users of your Firebase, whether they are authenticating via email / password, Facebook, Google, etc.
Prior versions of Firebase authentication (i.e. Firebase Simple Login) put an email address in the security rules auth
variable, but this was removed because (1) not all users will have email addresses, (2) users may have multiple email addresses, and (3) email addresses can change. As a result, they're not ideal for indexes in Firebase.
Original Answer:
However, if you'd rather key your data based upon e-mail address, you can use the .replace()
method in security rules to simply replace the periods with commas directly in your security rules. For example:
".read": "root.child('users').child(auth.email.replace('.', ',')).exists()"
See https://www.firebase.com/docs/security/string/replace.html for more details.