调用 Reports API 时出现错误:
<HttpError 403 when requesting https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-08-01?alt=json&maxResults=1 returned "Caller does not have access to the customers reporting data.">
有没有人见过这个错误?我错过了什么?我只是不明白为什么会显示或我应该检查什么。
问候。
编辑:
授权:
credentials = SignedJwtAssertionCredentials(
service_account_name='5163XXXXX@developer.gserviceaccount.com',
private_key=oauth2_private_key,
scope='https://www.googleapis.com/auth/admin.reports.usage.readonly')
# https://developers.google.com/api-client-library/python/guide/thread_safety
http = credentials.authorize(httplib2.Http())
service = apiclient.discovery.build('admin', 'reports_v1', http=http)
实际调用:
result = service.userUsageReport().get(
userKey='all',
date='2013-08-01',
maxResults=1).execute()
其他 API 可以很好地与该服务帐户配合使用。' https://www.googleapis.com/auth/admin.reports.usage.readonly ' 已正确添加到 OAuth2 域配置页面。