I’m encountering a permission error while calling the batchGet API.
API: “https://analyticsreporting.googleapis.com/v4/reports”
Response:
“message”: “User does not have sufficient permissions for this profile.”,
What I’ve tried:
In my Google Cloud Console API account, I have enabled the Analytics API and added the following scopes:
…/auth/analytics
…/auth/analytics.readonly
…/auth/analytics.edit
…/auth/analytics.manage.users.readonly
I generated credentials for accessing user data, including a web OAuth2 credential. I successfully generated a token and saw the …/auth/analytics.readonly permission on the consent screen while granting access. However, I receive a failure when calling the report API.
I also tried using a service account. Using the service account credentials JSON, I successfully called the report API.
I have double-checked my property ID, and it is valid. I also added my account as a tester user since my application is not published.
Using the same token, I tried the https://analyticsdata.googleapis.com/v1beta/properties/VIEW_ID:runReport API, and surprisingly, this API returned a 200 response.
Demo User is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.