I'm having some trouble accessing my firestore data via the python API. I've tried all the solutions that are mentioned in the other answers, but I still keep getting the same permission denied issue:
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Missing or insufficient permissions."
debug_error_string = "{"created":"@1636057424.408000000","description":"Error received from peer ipv4:x:x:x:x:443","file":"src/core/lib/surface/call.cc","file_line":1068,"grpc_message":"Missing or insufficient permissions.","grpc_status":7}"
>
Here's how I'm using the API:
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate('/users/88232/cred.json') #correct credentials path - also tried pasting the dictionary directly
firebase_admin.initialize_app(cred)
db = firestore.Client('myapp') #made sure it's the right project's name (I have multiple projects)
doc_ref = db.collection(u'sample').document(u'0SZxt2xXs7n8Vglz8wEu')
doc = doc_ref.get() #error here
Things I've tried:
- Use the service account credentials from firebase console in the API [1]
- Include data store owner as part of roles when creating a new service account and using these credentials in the API [2]
- Made sure Rules say
allow read, write: if true;
[3]
I'm not sure what else to try. Can someone please let me know if I have missed something?