Firestore PERMISSION_DENIED
Solution 1
After several I realized that the problem was not only under MacOs but with emulators. And by digging further I realized that it is AppCheck that I activated on the project which does not accept all the requests of the Debug mode under the emulator.
Solution 2
According to this post, there is an error with your app accessing the internet. Please check your network connection:
Check that you have the proper internet permissions in the androidManifest file (suggested by Abhishek Dutt).
If you are using an emulator, check if the emulator can access the internet using this post.
1st edition:
Can you please try this example code from this documentation for authentication:
service cloud.firestore {
match /databases/{database}/documents {
match /messages/{document=**} {
allow read, update, delete: if request.auth.uid == resource.data.uid;
allow create: if request.auth.uid != null;
}
}
}
This code must work only for reading and not writing:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if false;
}
}
}
Solution 3
Inside projectFolder/android/app/src/main/AndroidManifest.xml
add the following:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Mr Magloire
I am Senior Developper; CEO / CTO of App Gbameh, a transportation app in Ivory Coast made with Flutter. Gbameh : https://play.google.com/store/apps/details?id=com.mrm.gbamehapp
Updated on January 03, 2023Comments
-
Mr Magloire over 1 year
i have this problem on macOs when i code my flutter App, The same base code work in my windows pc but in macOs it don't work. As you can see in my logs, the application is connected but I still cannot make a request on my Firestore database
I changed the rule which was
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth != null; } } }
to
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if true; } } }
but i have the same error.
D/FirebaseAuth(11790): Notifying id token listeners about user ( tNGS8j375AYehEPDhZADPP80zLY2 ). W/DynamiteModule(11790): Local module descriptor class for providerinstaller not found. I/DynamiteModule(11790): Considering local module providerinstaller:0 and remote module providerinstaller:0 W/ProviderInstaller(11790): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0. W/Firestore(11790): (24.0.0) [Firestore]: Listen for Query(target=Query(usersProDEV where uuid == tNGS8j375AYehEPDhZADPP80zLY2 order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null} E/flutter (11790): [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.
The same code work in my windows PC
-
Alex Mamo over 2 yearsThere is some useful information written in this article, How to fix Firestore Error: PERMISSION_DENIED: Missing or insufficient permissions, that might help.
-
-
Mr Magloire over 2 yearsthank you but I added but it didn't change the error
-
Mr Magloire over 2 yearsthank for your response, at the same time, the connection is made via otp verification which opens a web page for the verification by captcha with firebase auth, after i put sms code which verify and I receive the token that you see in the console but get data via firestore is there that there is the problem.
-
Andres Fiesco Casasola over 2 yearsAdded some codes to my answer, could you try them
-
Arinzehills almost 2 yearsPlease i have the same issue with my emulator on mac, how did you solve it? where did u solve the problem on your pc
-
Mr Magloire almost 2 yearsI disabled AppCheck