我正在尝试使用 Google Apps 脚本中的 Drive REST API 读取 Google Photos。代码如下所示:
function myFunction() {
var files = Drive.Files.list({
maxResults: 10,
spaces: 'photos'
});
for (var i = 0; i < files.items.length; i++) {
var f = files.items[i];
Logger.log(f.title);
}
}
但是,如果我运行此函数,Google 会显示错误“授予的范围不允许访问所有请求的空间。(第 2 行,文件“代码”)”
Page with error https://i.stack.imgur.com/EaTZV.png
项目属性包含范围“https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive“ - 即所有对象都应该可用。但由于某种原因我收到此错误。我认为这是 Google Apps 脚本中的错误。有什么想法吗?
照片实际上并不是 Google Drive API V3 的一部分,而是 Picasa 网络相册数据 API 的一部分,因为您需要使用 Picasa 网络相册数据 API 范围进行身份验证。
https://picasaweb.google.com/data/ https://picasaweb.google.com/data/
or
https://www.googleapis.com/auth/drive.photos.readonly https://www.googleapis.com/auth/drive.photos.readonly
只需将该范围添加到您的脚本中,它应该可以工作,然后您就不能
"https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)