-
Authenticating Google Analytics API with user credentials instead of service accounts
“So, here’s what I’m trying to do. I need to connect to Google Cloud, but I’m supposed to use user credentials as service accounts can’t be added to my Google Analytics property. My desired user account has its email associated with each site in GA, plus the cloud project has Analytics Reporting API, Google Analytics Admin API and Google Analytics API switched on.
I checked out the docs at Googleapis which tells you to authorize with ‘gcloud auth application-default login’ first, and then use the bit of python code thereafter to authenticate with user accounts. But, all I get is an error message claiming ‘insufficient authentication scopes’.
By the way, I found this piece – I thought you might find it interesting. It’s an article I found that provides a potential solution to this problem, where you have to make an OAuth Client ID, and authenticate using the OAuth json key but with some extra scopes and linking to the OAuth file. Just so you know, the OAuth consent screen is running in test mode with my user account.
However, as luck would have it, I’ve hit another roadblock. This time I get an error message saying the Google Analytics Data API hasn’t been used before in the project, or it’s disabled, along with a link to enable it. But, the funky thing is, the project they’re referring to doesn’t exist in Google Cloud. It’s the OAuth Client ID! Oh, the joys! What do you think about this?”
Log in to reply.