2

I've been searching for a lot of problems that relate to this but I still didn't find the solution the error says

Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, linking, allowed)

[WriteStream]: (26986c6) Stream closed with status: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}.

[Firestore]: Write failed at users/rX5LRztKddW1c8RIBqyNShligJV2: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

and I've tried to change the firebase firestore rules in my console to be like this

service cloud.firestore {
match /databases/{database}/documents {
 match /{document=**} {
  allow read, write: if request.auth != null;
  }
 }
}

and after that still didn't affect anything. Usually I still can fetch data into a list and show in a gridview without having a user login. but now even when I log the user in it still didn't give me any of the data. been checking my dart code too and didn't find anything suspicious. tried to uninstall and install it back. nope, didnt works too.

Stanly
  • 533
  • 1
  • 5
  • 22

2 Answers2

1

I Resolve the problem by Un-enforced the app check on the firebase console. by doing this

 Project Settings > App-Check > APIs > Cloud Firestore click UnEnforce.

but in my case it still won't work. and i try to disconnect the flutter app with the firebase console and create a new one without connecting the app-check feature, and it work properly now

Stanly
  • 533
  • 1
  • 5
  • 22
-1

Did you try like this

allow read, write: if request.auth.uid != null;

or

 service cloud.firestore {   match /databases/{database}/documents {
 match /{document=**} {
   allow read: if auth != null;
   allow write: if auth != null;
 }   } }
Gejaa
  • 74
  • 1
  • 7
  • 1
    tried them already but still got the same error message `[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.` – Stanly May 12 '22 at 12:04
  • ussualy every time i open the app, without having a user logon. well the list of product still appear in the app. but right now suddenly i didnt appear anymore. tried to change to last time backup code and still got the same result – Stanly May 12 '22 at 12:11
  • can you able to authenticate and get the uid in this database? Is the problem happens after changing the rules or the code? – Gejaa May 12 '22 at 12:18
  • well i can. the problem come after i try to change my login page from using email into phoneauth. but now i trying to change back into email and password. and after it did some multi verifivation auth using phone number. but ussualy even without having account connect to the app. the list of item still appear – Stanly May 12 '22 at 12:34
  • Did you locally save your uid? Better uninstall the application and update the rules in firestore -> click publish it and try to read the documents(show the products) without authentication it won't come then do the login screen flow to get uid and show the products things. – Gejaa May 12 '22 at 12:57
  • locally save uid, did that already. deleted the app and install it again? done. well still on the same problem now :') – Stanly May 12 '22 at 13:01
  • so is there any other way to configure? or to fix it? – Stanly May 12 '22 at 13:59
  • Can you share minimal code to check ? – Gejaa May 12 '22 at 14:15
  • sure check this out https://stackoverflow.com/questions/72200227/suddenly-cant-fetch-any-data-inside-firebase-firestore-after-trying-to-use-tut?noredirect=1#comment127587582_72200227 – Stanly May 12 '22 at 14:43
  • Use the below links https://stackoverflow.com/questions/39632667/how-do-i-kill-the-process-currently-using-a-port-on-localhost-in-windows/39633428#39633428 and https://stackoverflow.com/questions/62684701/how-can-i-shut-down-the-local-firebase-emulators – Gejaa May 12 '22 at 15:10
  • after checking all thing, i found out the SHA and SHA-256 was changed, and i tried to download a new google-services.json. and put it in there. well still same problem :') – Stanly May 12 '22 at 15:16
  • @Royalindo I have same problem :( did you resolve it? It's stupid. every conf. right but it doesn't work on android. It's fine on ios – Ramazan Sağır May 19 '22 at 08:25
  • 1
    @RamazanSağır check your project console in and disable your app check. i tried to disable the appcheck but it still doesn't work. and the last thing i do was migrate to a new console project and it works properly – Stanly May 19 '22 at 08:49
  • @Royalindo you right I added app-check configuration to my project but I didn't use it. probably because of it. I will try that. How can I disable app-check. Should I delete the configurations on firebase console? – Ramazan Sağır May 19 '22 at 08:56
  • 1
    On the firebase console, Project Settings>App-Check>APIs>Cloud Firestore click UnEnforce. App-Check was disable then its work. Thanks @Royalindo – Ramazan Sağır May 19 '22 at 09:55
  • 1
    @RamazanSağır no problem :), if the UnEnforce didn't work. migrate to new console project – Stanly May 19 '22 at 10:33