返回“权限不足”

时间:2013-09-06 04:20:20

标签: python google-app-engine python-2.7 google-admin-sdk

class DirectoryV1Handler(webapp2.RequestHandler):
  @decorator.oauth_required
  def get(self):
    https = httplib2.Http()
    https = decorator.credentials.authorize(https)
    #service = build('directory', 'v1', http=https)
    service = build('admin', 'directory_v1', http=https, developerKey="YOUR-API-CONSOLE-KEY")
    #json.dumps(service)
    logging.info(service.userphoto().get(userKey='userKey'))
    user = service.userphoto().get(userKey='userKey').execute()
    logging.info(user)

运行上述内容时出现以下错误,请提供帮助: HttpError 403 when requesting https://www.googleapis.com/admin/directory/v1/users/{userKey}?alt=json&key="YOUR-API-CONSOLE-KEY" returned "Insufficient Permission"

1 个答案:

答案 0 :(得分:1)

您需要使用API​​控制台中的密钥替换YOUR-API-CONSOLE-KEY