【发布时间】:2018-05-16 21:24:05
【问题描述】:
我正在尝试为 Google Docs 编写插件。仅使用 DriveApp 和 MailApp 时它运行良好,但是一旦我尝试使用 UrlFetchApp,它就停止了工作。发生的情况是我弹出一个 OAuth 对话框:
[App] 需要您的许可才能访问您在 Google 上的数据
当我点击“查看权限”并选择我的 Google 帐户时,我会进入没有任何有用信息的 google 500 错误页面。
出现错误。请稍后再试。这就是我们所知道的。
我的项目属性显示以下范围:
脚本所需的 5 个 OAuth 范围:
https://www.googleapis.com/auth/documents
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/script.external_request
https://www.googleapis.com/auth/script.send_mail
这个脚本重现了这个问题:
function reproduceError() {
var doc = DocumentApp.getActiveDocument();
return UrlFetchApp.fetch("http://example.com");
}
当我从脚本中删除 UrlFetchApp 语句时,授权应用程序的提示消失,一切正常。
【问题讨论】:
标签: google-apps-script google-docs urlfetch