问题描述
对于使用Google Apps脚本创建的应用程序之一,某些范围会自动添加到我的应用程序中,如下所示:
For one of the application created using Google Apps Script, some scopes are automatically added as follows in my app:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/script.external_request
https://www.googleapis.com/auth/script.send_mail
https://www.googleapis.com/auth/spreadsheets
根据此文档,我已经按照所有步骤进行了OAuth客户端验证.但是,我的验证过程仍在进行中,支持团队表示我需要添加 https://www .googleapis.com/auth/drive.file 作用域到我的项目.
I've followed all the steps for OAuth Client Verification according to this documentation. But still, my verification process is pending and support team said that I need to add https://www.googleapis.com/auth/drive.file scope to my project.
任何人都知道如何添加/启用 https://www.googleapis.com/auth/现有项目中的drive.file 作用域.
Anybody know how to add/enable https://www.googleapis.com/auth/drive.file scope in the existing project.
推荐答案
对应用程序进行身份验证时,您应该请求其他范围
When you authenticate your application you should request the additional scope
- 在Apps脚本编辑器中打开脚本项目.
- 在菜单中,选择文件">项目属性".
- 选择作用域"选项卡.
- 查看脚本当前所需的作用域,并确定需要进行哪些更改.完成后,单击取消".
- 如果清单文件appsscript.json在左侧导航栏中不可见,请选择查看">显示清单文件"菜单项.
- 在左侧导航栏中选择appsscript.json文件以将其打开.
- 找到标记为oauthScopes的顶级字段.如果不存在,则可以添加它.
- oauthScopes字段指定一个字符串数组.
示例
{
...
"oauthScopes": [
" https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/userinfo.email"
],
}
在此处
这篇关于启用Google API OAuth范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!