Search code examples
firebasegoogle-cloud-firestorefirebase-security

Firestore Security Rules for specific user that was added in the Firebase console directly


I have this user where I added it directly from the firebase console, hence, it is not in any user collection.

Is it possible that only this specific userID can access collections of orders and products?

enter image description here


Solution

  • If it's only one user then you can restrict read access of those collections to that specific UID using the following rule:

    match /orders/{orderId} {
      allow read: if request.auth.uid == "firebase_user_id";
    }