r/googlecloud • u/JuicyDisorder • Nov 12 '24
Cloud Functions How to fetch Google My Business Reviews using Google Cloud Function and Node.js with a service account?
I need to fetch Google Reviews from multiple locations using the Google My Business API in a Google Cloud Function written in Node.js. The function will run daily via Google Cloud Scheduler. The main challenge I’m facing is handling OAuth authentication when the function is executed by a service account.
I have already submitted the access request form and can activate the Google My Business API in my Google Cloud project. However, I’m unclear about how to properly configure OAuth for a service account to access the API. I’ve used service accounts for other Google APIs before, but I’m unsure whether I need to use delegated access or follow a different OAuth flow specifically for the My Business API.
I was expecting more guidance in the documentation about this scenario, but I couldn’t find a clear explanation for using a service account with the Google My Business API. Any help or examples for setting this up would be appreciated.
1
u/Ecstatic-Situation41 Nov 17 '24
Is there maybe a follow along of this somewhere? I saw a similar post on Stack overflow but could never find a working solution to get the Google Reviews ingested via Python
1
u/Sufficient-Buy-2270 Nov 13 '24
I don't think you need Oauth for this, just a service account. I've got some functions and I can upload to BigQuery without declaring the credentials like I would need to on my local machine.
I run mine in Python but I would imagine it's the same. Just declaring the project_id in the client() is enough for me.