Arg, there was an API error : 403 : Insufficient Permission

996 views
Skip to first unread message

khub...@simplyhired.com

unread,
Apr 28, 2015, 5:30:19 PM4/28/15
to google-analytics...@googlegroups.com
I am getting the 403 error when I do the following in Python:

  # Get credentials for a service account

  client_email = 'XXX'

  with open("XXX") as f:

        private_key = f.read()

  credentials = SignedJwtAssertionCredentials(client_email, private_key, 'https://www.googleapis.com/auth/sqlservice.admin')

...

 http = credentials.authorize(http)

...

service = build('analytics', 'v3', http=http)

...

accounts = service.management().accounts().list().execute()


The last call through the service object is what is causing the error.

We have added the service account email address to our Google Analytics Profile using the Analytics web UI.


Any ideas?


Thank you, Ken

Message has been deleted

chilli...@gmail.com

unread,
May 8, 2015, 6:28:55 AM5/8/15
to google-analytics...@googlegroups.com
I am getting the same problem. 


Thank you

Matthew Cohoon

unread,
May 12, 2015, 12:10:40 PM5/12/15
to google-analytics...@googlegroups.com
Can you provide a little more details? Are you using a service account? Have you added that service account as a user to the view (profile)? Are you using the correct ga:xxxx table ID? you can use the Account Explorer to see which views you actually have access. What scope is your code using?

More often then not a "403 Insufficient permissions" results when you are attempting request data from a view to which you do not have access.
-Matt

--
You received this message because you are subscribed to a topic in the Google Groups "Google Analytics Reporting API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-analytics-data-export-api/F3HFuFqPy_o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-analytics-data-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chilli...@gmail.com

unread,
May 12, 2015, 12:41:58 PM5/12/15
to google-analytics...@googlegroups.com
Hi 

I got working now it was the ID was wrong, I got the right ID from using  Account Explorer

Thank You. 

To unsubscribe from this group and all its topics, send an email to google-analytics-data-export-api+unsubscribe@googlegroups.com.

Ken Hubbard

unread,
May 12, 2015, 6:16:54 PM5/12/15
to google-analytics...@googlegroups.com
I found the cause of the error. It was an improper scope!

Thank, you Ken

Linda Lawton

unread,
May 20, 2015, 3:07:21 AM5/20/15
to google-analytics...@googlegroups.com
This tutorial might help you:   http://www.daimto.com/googleanalytics-authentication-csharp/

Remember that a service account needs to be granted access before you can use it.   Go to the admin section of the google analytics website and add the service account email as a user at the account level, it must be the account level.  

Seriously the account level.

Linda
Reply all
Reply to author
Forward
0 new messages