I'm struggling with a basic Firebase security concept. Suppose I have, for example, two (eventual) google-authenticated (using OAUTH) users of my web app which uses Firebase as its data store; the users are alice@gmail.com and bob@gmail.com. I know they will eventually log in, and when they do, I will authenticate them to firebase using the Google OAuth facility. Neither has yet used my Firebase app. Furthermore, when they do log in, I trust that Google's OAUTH service is verifying that the person who claims to be bob@gmail.com is in fact bob, at least insofar as that he knows bob's password for Google's identity service.
Suppose that I want to create a firebase document collection with three nodes such that both alice and bob can read documents in node 1 (but other authenticated or unauthenticated users cannot); all users, including unauthenticated ones, can read documents in node 2 but cannot write them; but only bob@gmail.com can write any document in any node (Bob is a "superuser".)
But here's where I get stuck, when looking at various examples on Firebase and elsewhere: I want to set up these firebase rules before either alice or bob has ever logged into to my Firebase-backed application for the first time. So while I initially know their gmail addresses, I do not (yet) know their unique user ids. All the examples I have come across seem to depend on the fact that I know in advance the value of their UID (such as the example in the answer here, where john and mary's twitter UIDs are specified e.g. john's is twitter:2544215)
How do I define the security rules for Firebase in advance of these users ever having initially logged in; that is, what if I don't (yet) know that bob@gmail.com has a UID of 2544215?
I'm hoping someone can show a snippet of a security rule example.