4

Im getting error on using Google API. having right to connect with Google Drive and add new sheet and insert data into it.

It was working till yesterday but when i run the application today. Im getting error :

Error appears after users given token and tried to access the DRIVE API to get all the files

domain: "usageLimits"
extendedHelp: "https://code.google.com/apis/console"
message: "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
reason: "dailyLimitExceededUnreg"

I have not changed any settings. Following API are enables for my application access token. Do i have to add / enable more API to make it work.

enter image description here

Shan Khan
  • 9,667
  • 17
  • 61
  • 111
  • Did you ensure that the OAuth Client ID that you're using is associated with the same Developers Console project? – Patrick Feb 18 '16 at 04:35
  • 1
    Based from Google's reference, this error could happen when an application performs the requests without either apiKey(old api) or (client_secret, client_id). You will have `dailyLimitExceededUnreg` error if you were not granted access to the API during the preview phase and/or if you just make an API call without an API key or OAuth 2 token. Refer to this [forum](https://groups.google.com/forum/#!topic/youtube-api-gdata/6qrXtS1hTFQ). – abielita Feb 18 '16 at 06:30
  • yes both the client Id , client secret are the same in application and developer console it was working fine day back and i made no change in oauth settings. – Shan Khan Feb 18 '16 at 14:53

2 Answers2

5

I was using NodeJS to download a file, but was forgetting to pass the auth.

Initially I was using:

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'
  });
}

afterwards, I added an auth argument to the function, and passed it to the export method as well:

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

I am getting auth by creating an instance of google-auth-library

Daniel Apt
  • 2,468
  • 1
  • 21
  • 34
4

The problem was while getting access token. I was not providing correct scopes. When i changed the scope to

https://spreadsheets.google.com/feeds https://docs.google.com/feeds https://www.googleapis.com/auth/drive.file

it worked fine

Shan Khan
  • 9,667
  • 17
  • 61
  • 111