Google 驱动器 API 超出未验证使用的错误每日限制
Google Drive API Error Daily Limit for Unauthenticated Use Exceeded
我在使用 Google API 时遇到错误。
有权连接 Google 驱动器并添加新的 sheet 并向其中插入数据。
它一直工作到昨天,但当我 运行 今天应用程序时。
我收到错误:
用户给出令牌并尝试访问驱动器API以获取所有文件后出现错误
domain: "usageLimits"
extendedHelp: "https://code.google.com/apis/console"
message: "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
reason: "dailyLimitExceededUnreg"
我没有更改任何设置。
以下 API 是为我的应用程序访问令牌启用的。我是否必须添加/启用更多 API 才能使其正常工作。
问题出在获取访问令牌时。我没有提供正确的范围。
当我将范围更改为
https://spreadsheets.google.com/feeds https://docs.google.com/feeds
https://www.googleapis.com/auth/drive.file
效果很好
我正在使用 NodeJS 下载文件,但忘记通过身份验证。
最初我使用的是:
function downloadFiles() {
const service = google.drive('v3');
const dest = fs.createWriteStream('/tmp/foo.csv');
const fileId = '12345_ID_GOES_HERE';
service.files.export({
fileId: fileId,
mimeType: 'text/csv'
});
}
之后,我向函数添加了一个 auth
参数,并将其也传递给了 export
方法:
function downloadFiles(auth) {
const service = google.drive('v3');
const dest = fs.createWriteStream('/tmp/foo.csv');
const fileId = '12345_ID_GOES_HERE';
service.files.export({
auth: auth,
fileId: fileId,
mimeType: 'text/csv'
})
}
我通过创建 google-auth-library
的实例得到 auth
我在使用 Google API 时遇到错误。 有权连接 Google 驱动器并添加新的 sheet 并向其中插入数据。
它一直工作到昨天,但当我 运行 今天应用程序时。 我收到错误:
用户给出令牌并尝试访问驱动器API以获取所有文件后出现错误
domain: "usageLimits"
extendedHelp: "https://code.google.com/apis/console"
message: "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
reason: "dailyLimitExceededUnreg"
我没有更改任何设置。 以下 API 是为我的应用程序访问令牌启用的。我是否必须添加/启用更多 API 才能使其正常工作。
问题出在获取访问令牌时。我没有提供正确的范围。 当我将范围更改为
https://spreadsheets.google.com/feeds https://docs.google.com/feeds https://www.googleapis.com/auth/drive.file
效果很好
我正在使用 NodeJS 下载文件,但忘记通过身份验证。
最初我使用的是:
function downloadFiles() {
const service = google.drive('v3');
const dest = fs.createWriteStream('/tmp/foo.csv');
const fileId = '12345_ID_GOES_HERE';
service.files.export({
fileId: fileId,
mimeType: 'text/csv'
});
}
之后,我向函数添加了一个 auth
参数,并将其也传递给了 export
方法:
function downloadFiles(auth) {
const service = google.drive('v3');
const dest = fs.createWriteStream('/tmp/foo.csv');
const fileId = '12345_ID_GOES_HERE';
service.files.export({
auth: auth,
fileId: fileId,
mimeType: 'text/csv'
})
}
我通过创建 google-auth-library
auth