服务帐户json文件是什么样的?



因此,当我想为我的g-suite开发一个自动化系统创建一个服务帐户时,它提示我下载我认为是服务帐户凭证的东西。我下载了一个名为client_secret_118180615763713827329的文件。Json,包含以下内容(将删除敏感数据)

{  
   "installed":{  
      "client_id":"clientid",
      "project_id":"projectname",
      "auth_uri":"https://accounts.google.com/o/oauth2/auth",
      "token_uri":"https://accounts.google.com/o/oauth2/token",
      "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"
   }
}

但是,我无法获得服务帐户来获得授权。我一直得到以下错误:

Uncaught exception 'Google_Service_Exception' with message '{ "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } }

你知道怎么了吗?

确保您按照此链接https://developers.google.com/api-client-library/php/auth/service-accounts上的指南对API调用进行身份验证。"Login Required"错误信息表示您尚未对该用户进行身份验证,因此不授予您访问权限。

最新更新