使用Client_Secret.JSON文件连接到Google电子表格API时出现403 Permission Denied错误

时间:2018-05-07 14:20:15

标签: google-drive-api

我能够使用client_secret.json跟随我的应用程序使用google电子表格API查询googlespread表。

但是,使用我的应用程序的其他人获得403权限被拒绝错误。

使用开发人员控制台,我可以为项目创建一个新用户,但这只返回我已经拥有的client_secret.json文件。

如何向用户授予权限?

    INFO:oauth2client.client:Refreshing access_token
    ERROR:kernel_admin.__main__:{
      "error": {
        "code": 403,
        "message": "Google Sheets API has not been used in project     
626378963637 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sheets.googleapis.com/overview?project=626378963637 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console API activation",
            "url": "https://console.developers.google.com/apis/api/sheets.googleapis.com/overview?project=626378963637"
          }
        ]
      }
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

转到Google Dev Console并首先启用Sheets API:

enter image description here

要为驱动器中的文件(包括Google Spreadsheets)创建权限,请使用Permissions.create