【问题标题】:Google drive API SCOPE : https://www.googleapis.com/auth/drive谷歌驱动 API 范围:https://www.googleapis.com/auth/drive
【发布时间】:2020-06-29 00:28:36
【问题描述】:

我正在制作一个多租户平台,将客户的 Google 驱动器集成到:

  1. 在他们的 Google 云端硬盘中创建一个文件夹
  2. 与租户共享编辑器访问权限
  3. 允许租户创建子文件夹和写入文档。

我正在使用 SCOPE:https://www.googleapis.com/auth/drive,效果很好。 但是,SCOPE 非常普遍,并且授予完全许可范围以访问用户的所有文件。

我只是想创建一个文件夹编辑器来访问其中的内容。我不想访问客户之前在其云端硬盘中拥有的任何内容。

您认为有什么方法可以限制 SCOPE API?

【问题讨论】:

  • 这样的话,用https://www.googleapis.com/auth/drive.file的范围代替https://www.googleapis.com/auth/drive怎么样? https://www.googleapis.com/auth/drive.file 的官方文档说是Per-file access to files created or opened by the app. File authorization is granted on a per-user basis and is revoked when the user deauthorizes the app.。这是你期待的方向吗?
  • 谢谢!这行得通。它给了我很多错误,我在你的消息之前尝试过。有时,第二次肯定会创造魔法。
  • 感谢您的回复。我很高兴你的问题得到了解决。当您的问题解决后,您可以将其发布为答案吗?这样,它对有同样问题的用户很有用。
  • 附注:我将在此应用程序的早期开始验证过程。

标签: scope google-drive-api editor multi-tenant


【解决方案1】:

感谢@Tanaike!范围:https://www.googleapis.com/auth/drive.file 解决了我的问题。

在这种情况下,如何使用范围 https://www.googleapis.com/auth/drive.file 而不是 https://www.googleapis.com/auth/drive?的官方文件 https://www.googleapis.com/auth/drive.file 表示按文件访问 应用程序创建或打开的文件。文件授权是在 以每个用户为基础,并在用户取消对应用程序的授权时被撤销。是 这是你期望的方向? – Tanaike 58 分钟前

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-05
    • 2018-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多