我创建了一个应用程序,该应用程序应该将公开共享的Google文档复制到登录用户的Google云端硬盘中。如果将范围设置为https://www.googleapis.com/auth/drive
,则效果很好,但是如果将范围限制为https://www.googleapis.com/auth/drive.file
,则会看到以下错误:
req-url: https://content.googleapis.com/drive/v3/files/1vpJM9XgJzBI6oHAZCupRTF0TdIvgiq5tTl1kYFt8zLg/copy?alt=json&key=AIzaSyAON3JJQtrQYO3RcuRQo7BnFw8hzVkEDUE
req-payload: {"name":"Invoice 23rd Apr 11:06pm","parents":["1mnBEoqL677quoLGpKHY-2kzh8j7WU-Od"]}
response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "File not found: 1vpJM9XgJzBI6oHAZCupRTF0TdIvgiq5tTl1kYFt8zLg.",
"locationType": "parameter",
"location": "fileId"
}
],
"code": 404,
"message": "File not found: 1vpJM9XgJzBI6oHAZCupRTF0TdIvgiq5tTl1kYFt8zLg."
}
}
NOTE
的src文件可在https://docs.google.com/document/d/1vpJM9XgJzBI6oHAZCupRTF0TdIvgiq5tTl1kYFt8zLg/edit?usp=sharing中公开获得