User does not have sufficient permissions for this property
S

1

11

I use sample code

cd cloudshell_open/nodejs-analytics-data/samples/
node quickstart_json_credentials.js propertyId MY.json

Response is error.

7 PERMISSION_DENIED: User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.

Scriptural answered 15/4, 2021 at 7:43 Comment(0)
P
27

User does not have sufficient permissions for this property. To learn more about Property ID,

Is an access issue, the user you are authenticating as does not have permissions to access the Google Analytics Account that you are trying to access.

The tutorial you are using tells you to create a service account, you have not granted the service account permissions to access your Google Analytics account.

Open the service account json file or go to Google developer console and find the service account email address it has an @ in it. Then go to Google analytics web application under the admin section and add the Service account as a user.

As you are using the data api you only need to grant it read access.

If it helps i have a video which shows you exactly how to do it. User doesn't have any google analytics accounts easy solution

I have posted an issue on the issue form to get the sample fix. It does not tell you how to grant the service account access. 93

Picky answered 15/4, 2021 at 8:3 Comment(7)
All the problems have been solved with your great advice. I am very grateful. Thank you!!πŸ˜„ – Scriptural
"add the Service account as a user." This line helps us. – Autarch
I added the Service account as a user in GA4. I tried with both viewing as well as with editor rights, but I keep getting the same error message. – Arriviste
sounds like you didnt add it to the correct account it has to be at the account level – Picky
Hi @LindaLawton-DaImTo. I was able to retrieve data from the da4 API by reading the credentials.json file from my local computer. I uploaded the same code to cloud functions and selected the same account as the local one as the runtime service account. But I'm getting the error in the question. Why might this happen? – Equanimous
Are you sure its a service account – Picky
Sorry, there was a simple syntax error, there is no problem now. Thank you for your response. – Equanimous

© 2022 - 2024 β€” McMap. All rights reserved.