I'm using a Google Cloud Function to perform some actions on my Firestore collection at set intervals using Cloud Scheduler (all in the same project).
It function itself is working fine and authenticating. However, I'm authenticating using the service account JSON in my python code as per below:
cred = credentials.Certificate({
"type": "service_account",
"project_id": "...",
"private_key_id": "...",
"private_key": "...",
"client_email": "...",
"client_id": "...",
"auth_uri": "...",
"token_uri": "...,
"auth_provider_x509_cert_url": "...",
"client_x509_cert_url": "..."
})
firebase_admin.initialize_app(cred)
db = firestore.client()
I know that there is a better way to authenticate, given the database and function are in the same Google Cloud project. However, I can't find any documentation on how to do this via the inline editor.
How can I authenticate to, and reference my Firestore database without using the service account?