Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.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 apps script 如何为我的Google Web应用程序创建弹出式授权_Google Apps Script_Google Apps - Fatal编程技术网

Google apps script 如何为我的Google Web应用程序创建弹出式授权

Google apps script 如何为我的Google Web应用程序创建弹出式授权,google-apps-script,google-apps,Google Apps Script,Google Apps,我不熟悉网络脚本和部署网络应用,我有一个问题,我要求用户授权使用网络应用,但没有弹出任何内容来请求授权 我在这里找到了这个,它似乎是我所需要的,但我不确定如何使用它。我尝试在doGet开始时调用onOpen函数,但什么也没发生。我也看不到authorize函数在何时何地被调用。我的Web应用程序也在使用表单,所以我删除了处理DocumentApp的所有代码行 这是我对代码的修改版本 function onOpen() { if(!UserProperties.getProperty('aut

我不熟悉网络脚本和部署网络应用,我有一个问题,我要求用户授权使用网络应用,但没有弹出任何内容来请求授权

我在这里找到了这个,它似乎是我所需要的,但我不确定如何使用它。我尝试在doGet开始时调用onOpen函数,但什么也没发生。我也看不到authorize函数在何时何地被调用。我的Web应用程序也在使用表单,所以我删除了处理DocumentApp的所有代码行

这是我对代码的修改版本

function onOpen() {
  if(!UserProperties.getProperty('author')){
    var html = HtmlService.createHtmlOutputFromFile('index1')
    .setTitle("Install Menu").setWidth(400);
  }else{
    var html = HtmlService.createHtmlOutputFromFile('index2')
    .setTitle("Mailmerge Menu").setWidth(400);
  }
}

function authorize(){
  UserProperties.setProperty('author','yes');
  var html = HtmlService.createHtmlOutput('Authorization complete<br>Thanks<br><br>please refresh your browser').setTitle("Confirmation").setWidth(400);
}
收到响应后,我将解析它,并在单独的类中使用“result”中的数据

if (_webRequest != null && _webRequest.isDone)
{
    result = JsonUtility.FromJson<WebResponsePacket> 
    (_webRequest.downloadHandler.text);
     Debug.Log("Successful Request");

    return true;
}
if(_webRequest!=null&&u webRequest.isDone)
{
结果=JsonUtility.FromJson
(_webRequest.downloadHandler.text);
Debug.Log(“成功请求”);
返回true;
}

Web应用程序只能发布为以您的身份执行或以用户的身份执行。不能两者兼而有之。当然,如果您将其发布为以用户身份执行,那么即使您是所有者,也可以以用户身份登录。谁拥有谷歌表?是每个用户都在使用自己的Google工作表,还是每个用户都在使用您的Google工作表?@DerpDerp如果附加执行设置设置为以用户身份执行,则会自动显示登录提示。确保您的设置正确且未登录。还记得每次部署时web应用程序URL的更改(如果使用新编辑器)@RafaGuillermo如何检查我是否登录(在手机上)。当我使用新的编辑器重新部署执行用户设置时,web应用程序URL没有更改。@我拥有google工作表,该应用程序只是允许用户通过移动应用程序直接从工作表上载/下载数据。我想将其发布为以用户身份执行,但无法获得登录提示appear@RafaGuillermo我又尝试了一次,所有的谷歌账户都从设备上注销了,但不幸的是仍然没有。我的部署设置可能是偶然错误的吗?目前,我正在以用户身份访问web应用程序,任何拥有google帐户的人都可以访问它
_webRequest = UnityWebRequest.Get("web app url here");
_webRequest.SendWebRequest();
if (_webRequest != null && _webRequest.isDone)
{
    result = JsonUtility.FromJson<WebResponsePacket> 
    (_webRequest.downloadHandler.text);
     Debug.Log("Successful Request");

    return true;
}