【问题标题】:Google Drive account returns 403 usageLimits due to incorrect authorization header in request由于请求中的授权标头不正确,Google Drive 帐户返回 403 usageLimits
【发布时间】:2013-06-29 14:53:33
【问题描述】:

我正在使用 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); 
            });
        });  
    }
};

【问题讨论】:

    标签: google-drive-api google-api-nodejs-client


    【解决方案1】:

    您是否启用了 Drive SDK/API?

    转到Google APIs Console > Services > 并打开 Drive SDK 和 Drive API。

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

    【讨论】:

    • 在 API 控制台中启用了 Google Drive API。这似乎不是问题。
    【解决方案2】:

    现在可以解决了,因为问题是由于请求没有授权详细信息。 解决方案是使用以下:

    req = client.drive.files.list().withAuthClient(oauth2client);
    

    【讨论】:

      猜你喜欢
      • 2012-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-27
      • 2018-10-12
      • 1970-01-01
      • 1970-01-01
      • 2021-07-16
      相关资源
      最近更新 更多