【问题标题】:How to execute UrlFetchApp.fetch() without displaying the OAuth consent screen如何在不显示 OAuth 同意屏幕的情况下执行 UrlFetchApp.fetch()
【发布时间】:2021-07-20 16:46:05
【问题描述】:

我正在使用 Google Apps 脚本创建一个应用程序。

此应用使用 UrlFetchApp.fetch(),因此首次运行该应用的用户将看到 OAuth 同意屏幕。

顺便说一下,app需要的范围如下。 https://www.googleapis.com/auth/script.external_request

是否有隐藏同意屏幕以减少用户交互的解决方案?

【问题讨论】:

  • 请添加您如何设置 Web 应用部署的详细信息,并简要说明您为什么要这样设置。
  • 我想将它与 Google Chat 链接,因此我在代码编辑屏幕中选择 Publish > Deploy from Manifest。

标签: google-apps-script google-cloud-platform google-oauth urlfetch


【解决方案1】:

如果您愿意并且用户是否会使用您的凭据执行您的网络应用程序并不重要,请选择 Execute as 下的 Me,这样他们就不需要与 OAuth 屏幕交互。

参考:

【讨论】:

  • 我用你教我的方法解决了这个问题。当我在代码编辑屏幕中选择 Publish > Deploy from Manifest 时,是否可以隐藏 OAuth 屏幕?
  • 引用文档:Certain OAuth scopes are sensitive because they allow access to Google User Data. If your script project uses scopes that allow access to user data, the project must go through OAuth client verification before you can publish it publicly as a web app or add-on. 因此,考虑到这一点,让您的脚本访问用户数据需要 OAuth。我认为我们不能在这方面隐藏/绕过 OAuth。参考:OAuth Verification
  • 嗨@noobchan,如果我们回答了您的问题,请点击左侧的接受按钮(复选图标)。通过这样做,社区中可能与您有同样担忧的其他人将知道他们的问题可以得到解决。如果您无法使用接受按钮,请随时告诉我。 how to accept answer
猜你喜欢
  • 2018-03-01
  • 2019-08-15
  • 2020-05-02
  • 1970-01-01
  • 2021-08-25
  • 1970-01-01
  • 2019-12-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多