javascript - 谷歌云端硬盘 API V3 : Creating file permissions for a domain

标签 javascript google-drive-api file-permissions

尝试通过 Google 云端硬盘的 API V3 添加文件权限,但遇到了以下错误。我希望允许来 self 的网站 mta.io 的请求能够读取该文件。该错误似乎来 self 在请求正文中传递的域,例如 example.com 工作正常并且已授予它权限。我是否需要将我的域列入白名单才能授予其文件权限?

作品:

{
  "role": "reader",
  "type": "domain",
  "domain": "example.com"
}

不起作用:

{
  "role": "reader",
  "type": "domain",
  "domain": "mta.io"
}

错误:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "The specified domain is invalid or not applicable for the given permission type.",
    "locationType": "other",
    "location": "permission.domain"
   }
  ],
  "code": 400,
  "message": "The specified domain is invalid or not applicable for the given permission type."
 }
}

我正在使用try it在 API 网站上找到的功能。

最佳答案

明白了,您只能使用 G Suite 域。 这很糟糕,但为了与某个域独家共享文件权限,您需要拥有一个 G Suite 帐户并验证您是否拥有该域 - 该域需要与您的 G Suite 帐户链接。

https://developers.google.com/drive/v3/web/about-permissions#types_and_values

For example, a permission with a type of domain may have a domain of thecompany.com, indicating that the permission grants the given role to all users in the G Suite domain thecompany.com

关于javascript - 谷歌云端硬盘 API V3 : Creating file permissions for a domain,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43314298/

相关文章:

javascript - 如何使用 Jquery 在 HTML 表格中添加行?

javascript - 如何使用 JavaScript 中的 split 函数和正则表达式按长度分割字符串?

javascript - 向窗口的文档添加一个不是创建它的元素有什么害处吗?

google-apps-script - 如何使用 Google Apps 脚本命名当前版本的 Google 电子表格、文档或演示文稿?

android - 我在哪里包含云端硬盘服务帐户的文件

python - 如何在保留现有权限的同时使用 os.chmod 更改文件权限?

Java 6 : Create a modified copy of file perserving original permission

javascript - 一个 grunt 插件如何包装另一个插件

c - 通过 HTTP 请求上传文件到 Google Drive (C)

linux - linux修改目录权限