2

Get the error 'Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.' When adding 'https://www.googleapis.com/auth/drive' to scope. If I take this out of the scope it works for all other functions related to the other scopes. I need this in the scope to copy a file.

public handleClientLoad() {
      gapi.load('client:auth2', function () {
        gapi.client.init({           
          discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4',
            'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'],
          clientId: 'MyclientID*.apps.googleusercontent.com',
          scope: ` https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.metadata.readonly https://www.googleapis.com/auth/spreadsheets `
        }).then(() => {

            gapi.client.drive.files.copy({
               'fileId': 'My File ID', 
               'resource': {
                 'parents': [
                  'MY Parent File'
                 ],
                 'name': 'My File Name'
               }
             })

        });
      });
    }
Ron
  • 21
  • 4
  • You may refer to this [thread](https://stackoverflow.com/questions/19335503). Make sure that you have enabled API at Google Console. Wait a few minutes after turning on, and ensure that you get a fresh token each time before trying it. This [error](https://stackoverflow.com/questions/35467945) 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. – abielita Sep 27 '17 at 18:07

2 Answers2

1

That error is returned when you submit an API request with no Authorization http header. Can you trace the network traffic to see if this is the case. If so, I suspect that you are doing something such as faulty syntax to break the gapi client library such that it can't function correctly. Are there any console messages?

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • This is the console error message: {domain: "usageLimits", reason: "dailyLimitExceededUnreg", message: "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", extendedHelp: "https://code.google.com/apis/console"} The network traffic shows all 200's and 304's – Ron Sep 27 '17 at 18:54
0

I was able to resolve the problem by adding this code in the original question.

var GoogleAuth;
gapi.load('client:auth2', function () {

// callback
.then(() => {
      **GoogleAuth = gapi.auth2.getAuthInstance();
      GoogleAuth.signIn();**
        gapi.client.drive.files.copy({
// implement functionality
Derek Brown
  • 4,232
  • 4
  • 27
  • 44
Ron
  • 21
  • 4