// ... role=reader, type=anyone, with_link=true .... $perms
$service->permissions->insert($fileId, $perm); // see error below
HTTP Code: 403
[
{
"domain": "global",
"reason": "forbidden",
"message": "Insufficient permissions for this file",
"locationType": "other",
"location": "file.permissions"
}
]
特定域的用户无法共享链接。上面的错误未在此处列出https://developers.google.com/drive/v2/web/handle-errors
域名管理员确信其域名的所有用户都可以“与公众共享”。
答案 0 :(得分:2)
您可能需要检查是否为用户设置了适合他们的范围,以便他们访问该文件。见Authorizing requests with OAuth 2.0。范围是为某些用户授予对文件或文件夹可以执行的操作的权限。见What scope or scopes does my app need?
作为一般规则,请选择尽可能最严格的范围,并避免请求您的应用实际上不需要的范围。用户可以更轻松地访问有限的,明确描述的范围。相反,用户可能会毫不犹豫地授予对其文件的广泛访问权限,除非他们真正信任您的应用并了解其需要信息的原因。
您可能还想查看Perform Google Apps Domain-Wide Delegation of Authority。此处建议您使用服务帐户,以便用户通过您的网络应用程序访问您的Google API。