【发布时间】:2020-06-29 00:28:36
【问题描述】:
我正在制作一个多租户平台,将客户的 Google 驱动器集成到:
- 在他们的 Google 云端硬盘中创建一个文件夹
- 与租户共享编辑器访问权限
- 允许租户创建子文件夹和写入文档。
我正在使用 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