0

I've recently started using FlutterFlow, on account creation... I have set it up so that it creates a users collection. The user gets created but not the collection. I can't even create a user document directly through the manage content section of Collections.

I've tried manually creating the users collection from Firebase directly but even that doesn't help. The collection can't be read by the app.

Here are the Firebase rules I'm using:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{document} {
      allow create: if request.auth.uid == document;
      allow read: if request.auth.uid != null;
      allow write: if request.auth.uid == document;
      allow delete: if false;
    }

    match /chats/{document} {
      allow create: if request.auth.uid != null && request.resource.data.users[request.auth.uid] == true;
      allow read: if request.auth.uid != null && resource.data.users[request.auth.uid] == true;
      allow write: if request.auth.uid != null && resource.data.users[request.auth.uid] == true;
      allow delete: if false;
    }

    match /chat_messages/{document} {
      allow create: if request.auth.uid != null && 
                      request.resource.data.user == request.auth.uid &&
                      request.resource.data.chat != null &&
                      exists(/databases/$(database)/documents/chats/$(request.resource.data.chat)) &&
                      get(/databases/$(database)/documents/chats/$(request.resource.data.chat)).data.users[request.auth.uid] == true;
      allow read: if request.auth.uid != null &&
                    exists(/databases/$(database)/documents/chats/$(resource.data.chat)) &&
                    get(/databases/$(database)/documents/chats/$(resource.data.chat)).data.users[request.auth.uid] == true;
      allow write: if false;
      allow delete: if false;
    }
  }
}
  • Can you also include your sample document structure in Firestore. I guess the rule should be like this: `if request.auth.uid == document.uid` – Shri Hari L Jul 14 '23 at 04:41

0 Answers0