【发布时间】:2014-02-11 13:34:45
【问题描述】:
我正在尝试将我的 Google 应用脚本/Google 电子表格设为模板。我遇到的唯一问题是身份验证。如果您尝试运行任何脚本,它将验证自己,但我需要它将自己部署为 WebApp。我正在使用:
function startWebApp() {
//Setup the webapp service
var service = ScriptApp.getService();
service.enable(service.Restriction.ALL);
Logger.log("WebApp Started");
}
当我从我在电子表格中创建的菜单中运行它时,它有一个很好的前端界面,它会要求授权,但下次你运行它时(我已经读过你需要运行一个函数两次,一次授权脚本,第二次实际运行函数)你得到
Your one shot authorization state is not valid. The script must be reauthorized. The script's reauthorization can be triggered by calling ScriptApp.invalidateAuth() and rerunning the script.
有没有更好的方法或不同的方法来允许脚本自行发布,还是我做错了?
【问题讨论】:
标签: javascript web-applications google-apps-script authorization