My goal is to make use of GCP's Firestore Python 3 API. I have created a service account and followed the official documentation for the setup. However, any request to Firestore still results in google.api_core.exceptions.PermissionDenied: 403 Missing or insufficient permissions
error. I made sure that Firestore database rules allow all reads & writes in Firebase console. I have added both Owner
& Cloud Datastore Owner
roles to my service account, but to no avail. I have tried providing credentials in 2 ways, neither of which has proven to be successful:
from google.cloud import firestore
# Method #1
import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = os.getcwd() + "/credentials.json"
db = firestore.Client()
# Method #2
from google.oauth2.service_account import Credentials
db = firestore.Client(project="my-project-id",
credentials=Credentials.from_service_account_file("credentials.json"))
I have run out of options and would appreciate any help with this problem.