-
Understanding the permission error in Google Analytics Admin API.
Hey guys, I need a little help here. I’ve been trying to use the Google Analytics Admin API and keep running into a permission issue. Here’s the code I’m working with:
`python
import os
from google.analytics.admin import AnalyticsAdminServiceClientos.environ[“GOOGLE_APPLICATION_CREDENTIALS”] = “service_account_credentials.json”
client = AnalyticsAdminServiceClient()
client.get_account(name=’accounts/134494883′)
`
But all I get is a
PermissionDenied: 403 The caller does not have permission error
.The odd thing is, I downloaded service account credentials as a key and it has full owner permissions. Also, I’ve got all the APIs I need (Google Analytics Admin API, Google Analytics API, and Analytics Reporting API) up and running.
I can see the requests are reaching the analytics admin API because I get a response, only it’s a permission error. I also used another method,
client.list_accounts()
, which doesn’t give an error but gives me a blank list. This is probably why the error rate is only 27%.What’s even weirder is I do have multiple UA and GA4 accounts under my google account. Here’s a screenshot of what I am seeing: [Link](https://i.stack.imgur.com/37B4E.png).
Surprised emoji! Any thoughts? Would appreciate any help you can offer.
Log in to reply.