将上传到驱动器帐户的权限授予其他用户

Give permission to upload to drive account to another user

我正在我的应用程序中开发一项功能,用户需要将其 google 云端硬盘帐户的访问权限授予另一个用户,以便第二个用户可以将文件上传到云端硬盘。

我一直在搜索 google drive android api 并查看了 demos 但我找不到与我想要的相关的任何内容。

这是可行的吗?如果是,那么我需要 api 提供什么来创建它?

我认为完全授予 google 驱动器访问权限的唯一方法是共享您的密码,这不是您想要的。您可以做的是共享一个文件夹,其他用户可以在其中移入和移出文件。

您可以使用 Permissions.create, setting the type to "user" and providing the email of that user. You can check code samples in Sharing Files in Drive API:

Permission userPermission = new Permission()
        .setType("user")
        .setRole("writer")
        .setEmailAddress("example@appsrocks.com");
driveService.permissions().create(fileId, userPermission)
        .setFields("id")
        .queue(batch, callback);

Permission domainPermission = new Permission()
        .setType("domain")
        .setRole("reader")
        .setDomain("appsrocks.com");
driveService.permissions().create(fileId, domainPermission)
        .setFields("id")
        .queue(batch, callback);

你可以阅读这个google forum,它似乎也在谈论同样的问题。