Admin Audit API "Access Not Configured"

30 views
Skip to first unread message

UMNtmg

unread,
Nov 3, 2011, 4:43:45 PM11/3/11
to google-app...@googlegroups.com
Hi, I'm trying to set up a Python script to access the Admin Audit tool on our education domain.  We've got Code enabled on the domain, and I've set up an Installed Application there to manage access.  So, I've got a client_id and a client_secret set up here, and am using that to try to set up an OAuth2 flow.  I've been unable to do so, as yet, and keep getting an "Access Not Configured" error.  I'm seeing some indication that I might need to use an API key, from looking at other postings, but the documentation within Code is saying that this would prevent us from getting an user level data, which is exactly what the Admin Audit tool should provide, so I don't think I want to do that.

Here's some code for what I've got:

FLOW = OAuth2WebServerFlow(
    client_secret='***',
    redirect_uri='urn:ietf:wg:oauth:2.0:oob',
    user_agent='audit-cmdline-sample/1.0')
  # If the Credentials don't exist or are invalid run through the native client
  # flow. The Storage object will ensure that if successful the good
  # Credentials will get written back to a file.
  storage = Storage('audit.dat')
  credentials = storage.get()
  if credentials is None or credentials.invalid == True:
    credentials = run(FLOW, storage)

  # Create an httplib2.Http object to handle our HTTP requests and authorize it
  # with our good Credentials.
  http = httplib2.Http()
  http = credentials.authorize(http)

  service = build('audit', 'v1', http=http)

  try:
    activities = service.activities()

    # Retrieve the first two activities
    print 'Retrieving the first 2 activities...'
    activity_list = activities.list(
    applicationId='207535951991', customerId='***', maxResults='2',
        actorEmail='us...@gpilot.edu').execute()
    print_activities(activity_list)

Any clues as to what might be going on?


Gunjan Sharma

unread,
Nov 7, 2011, 3:57:16 AM11/7/11
to google-app...@googlegroups.com
Hello 

Can you make sure that you are using the right customerId corresponding to your domain?
I was able to reproduce your error when I inserted wrong customerId.
You can get your customerId by making a get request to https://apps-apis.google.com/a/feeds/customer/2.0/customerId

Here is the doc for reference.
If it is right let us know.

Thanks
Gunjan Sharma

Reply all
Reply to author
Forward
0 new messages