1

我正在使用 google-api-nodejs-client 库来访问 Google Drive。在请求从驱动器获取所有文件时成功授权后,我收到以下错误:

code: 403,
message: 'Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.',
     data:
      [ { domain: 'usageLimits',
          reason: 'dailyLimitExceededUnreg',
          message: 'Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.',
          extendedHelp: 'https://code.google.com/apis/console' } ] }

在 SO 上浏览了类似的问题后,我发现错误可能是由于未正确设置 http Authorization 标头。我指的是https://github.com/google/google-api-nodejs-client/中的示例,无法继续进行。请帮忙。

这是代码:

var googleapis = require('googleapis'); 
count = function (accessToken) {
    if(accessToken) {
        googleapis
        .discover('drive', 'v2')
        .execute(function(err, client) {
            req = client.drive.files.list();            
            req.execute(function(err, result) {
                var count = 0;
                console.log(err);
                console.log(result); 
            });
        });  
    }
};
4

2 回答 2

0

您是否启用了 Drive SDK/API?

转到Google API 控制台> 服务 > 并打开 Drive SDK 和 Drive API。

这是此错误的常见可能原因之一,这可能不是您的错误的原因。

于 2013-07-02T15:34:30.423 回答
0

它现在工作了,因为问题是由于请求没有授权细节。解决方案是使用以下内容:

req = client.drive.files.list().withAuthClient(oauth2client);
于 2013-07-10T10:09:46.740 回答