Google sheets 方法电子表格.batchUpdate-doen';不能使用API密钥

Google sheets 方法电子表格.batchUpdate-doen';不能使用API密钥,google-sheets,google-api,google-oauth,google-spreadsheet-api,Google Sheets,Google Api,Google Oauth,Google Spreadsheet Api,方法BatchUpdate不适用于API密钥验证。 答复: { "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://d

方法BatchUpdate不适用于API密钥验证。 答复:

    {   "error": {
           "code": 401,
           "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
           "status": "UNAUTHENTICATED"   
        } 
    }
使用API密钥也不起作用。 我没有发现任何关于那个的东西。发生了什么事?

表示

授权范围 需要以下OAuth作用域之一:

你错了

请求缺少必需的身份验证凭据。需要OAuth 2访问令牌、登录cookie或其他有效的身份验证凭据。请参阅

声明您需要经过身份验证,并且需要Oauth 2访问令牌

你说你试过使用API密钥。API密钥用于访问公共数据。为了访问私有数据,您需要经过身份验证。这就是文件中所说的


为了做到这一点,请尝试我的工作,您需要使用
googleoauth2.0

虽然API键可以使用GET方法,但不幸的是,API键不能使用POST和PUT方法<代码>电子表格。batchUpdate使用POST方法。所以当您使用这个时,请使用OAuth2和服务帐户。很清楚。但在这种情况下,为什么“trythisapi”部分包含optionapi键呢?trytime是谷歌所有文档中的默认功能。这并不意味着谷歌文档中的所有方法都支持API密钥。Google假定您阅读了TryMe旁边的文档页面,并且知道您需要使用Oauth2进行身份验证。