Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets Google电子表格保护的Web应用访问级别_Google Sheets_Google Oauth - Fatal编程技术网

Google sheets Google电子表格保护的Web应用访问级别

Google sheets Google电子表格保护的Web应用访问级别,google-sheets,google-oauth,Google Sheets,Google Oauth,我已经部署了一个gsheets web应用程序,如果该web应用程序的“谁有权访问此文件”设置为“任何人,匿名”访问,则代码执行良好。下面是这个代码 var data = { 'command1': 'usermenu', 'command2': 'dopayroll' }; var options = { 'method' : 'post', 'payload' : data }; var response = UrlFetchApp.fet

我已经部署了一个gsheets web应用程序,如果该web应用程序的“谁有权访问此文件”设置为“任何人,匿名”访问,则代码执行良好。下面是这个代码

  var data = {
    'command1': 'usermenu',
    'command2': 'dopayroll'
  };
  var options = {
    'method' : 'post',
    'payload' : data
  };
  var response = UrlFetchApp.fetch(ScriptApp.getService().getUrl(), options);  
  getSpread().toast(response.getContentText()); 
我想做的是,将访问级别更改为“任何人”——即通过任何经过身份验证的google帐户访问(对吗?)。将以下代码添加到“var选项”,但返回错误代码401。我怎样才能做到这一点

  'header' : { 'Authorization': 'Bearer ' + ScriptApp.getOAuthToken() },

编辑;我应该补充一点,我是OAuth和其他相关领域的新手。

发布了一条现在不可见的回复

我的感谢做过测试的人,我现在可以确认所提出的解决方案是有效的。解决方案分为两部分。首先,下面正确的标题(“标题”应该是“标题”)

并添加以下注释以触发项目的驱动器范围访问

// DriveApp.getFiles()
// DriveApp.getFiles()