2
votes

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

        });
      });
    }
2
You may refer to this thread. 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 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

2 Answers

1
votes

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?

0
votes

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