0

I created a service account, got json configuration file and I request an access token using it. The response is ok, I receive token. When I upload file using it everything is ok, but when I try to view files from a folder it returns error message

Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

My service account only needs to access own files, it doesn't access files of any other users. My code for viewing files (right now I try to debug the response):

public List<String> getFilesList() {
    Http http = new Http();
    HttpRequest req = new HttpRequest();
    req.setMethod('GET');
    req.setEndpoint('https://www.googleapis.com/drive/v2/files?accessToken='+accessToken');
    HttpResponse resp = http.send(req);
    System.debug(resp);
    System.debug(resp.getBody());
    return null;
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Pati K
  • 129
  • 2
  • 11

2 Answers2

1

For the error Daily Limit for Unauthenticated Use Exceeded. Continued use requires sign, try to check in your Google developer console under APIs, the project associated with the API key. Example: https://console.developers.google.com/project/<your app id>/apiui/api. Make sure that the status for Google+API was set to ON.

Based from this SO question, that error implies that you haven't set up a Google APIs console project.

  1. Create a Google APIs Console project
  2. On the Services pane, enable all of the APIs that your project requires.
  3. On the API Access pane, click Create an OAuth 2.0 client ID. A dialog opens. Fill in your project's information. Click Next
  4. Choose the appropriate application type. Based on the tags you used for this post, I am guessing this is an iOS project so select Installed application.
  5. Enter your bundle ID. You don't need to enter an App Store ID until your app is listed there.
  6. Click Create Client ID.

You will see the client ID and client secret values. You will use these values to enable communication with your project and the Google APIs.

If you aren't already using it, see the Google+ iOS SDK and documentation for a full walk through. The task called "write moments" is similar in implementation and demonstrates how to connect to and use the Google+ REST APIs from within an iOS project that uses the SDK.

You'll need to specify the scope of plus.me to get the profile information.

Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
1

I found out what was the problem. I was sending access token in the url address instead of in the header. Eventually I did it like this:

public List<String> getFilesList() {
 Http http = new Http();
 HttpRequest req = new HttpRequest();
 req.setMethod('GET');
 req.setEndpoint('https://www.googleapis.com/drive/v2/files);
 req.setHeader('Authorization', 'Bearer '+accessToken);
 HttpResponse resp = http.send(req);
 return null;
}
Pati K
  • 129
  • 2
  • 11