0
votes
  • I had a Flutter application initialized and working perfectly fine with the Firebase.

  • And I had to remove the app from firebase due to some security reasons weeks ago.

  • Later I successfully added my application to Firebase and use the new google-services.json to get my application working again. The authentication is working fine but then I realized that none of my collections can read and write within the application.

  • When I go through the debug console I figured that there is an exception throwing each time I try to read or write a collection.

This is the exception I see when I try to add a test collection to my database.

W/Firestore(16689): (19.0.0) [Firestore]: Write failed at Test/123: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}```

Then I tried changing my Database rules to public. But the problem is still there.

My flutter doctor results Flutter details

Firebase dependencies and versions that I'm using in my project

  1. firebase_core: 0.4.0+9
  2. firebase_auth: 0.14.0+2
  3. cloud_firestore: ^0.12.9
  4. cloud_functions: 0.4.1+1
  5. firebase_messaging:
1

1 Answers

1
votes

Check your Database Rules in the firebase console if they are really open to your application. The rules should only allow read and write access in your use cases. You possibly prohibited this access in your newly initialized Database.

  function isSignedIn() {
    return request.auth.uid != null;
  }

  allow read, write: if isSignedIn() && request.auth.uid == resource.data.uid

public access would mean read and write are both always true.