質問

I am using google-api-nodejs-client library for accessing Google Drive. After successful Authorization when requesting to get all the files from drive I am getting following error :

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' } ] }

After browsing through similar questions here on SO, I found the error might be due to not setting the http Authorization header properly. I am referring to examples in https://github.com/google/google-api-nodejs-client/ and not able to proceed further. Please help.

Here is the code :

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); 
            });
        });  
    }
};
役に立ちましたか?

解決 2

Its wotking now, as the problem was due to request not having authorization details. Solution is to use following:

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

他のヒント

Did you enable Drive SDK/API?

Go to Google APIs Console > Services > and turn on Drive SDK and Drive API.

This is one of the common possible causes of this error and this might not be the cause of your error.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top