I'm trying to use the Google Drive API through the App 
Identity<https://developers.google.com/appengine/docs/java/appidentity/overview>interface
 provided with Google App Engine. This basically allows my web 
application to communicate with Google's APIs from server to 
server<https://developers.google.com/accounts/docs/OAuth2ServiceAccount>
.

However, after I set all the appropriate values and scopes, and enable all 
the right Google Drive knobs on the API console page, I still get this for 
a simple GET request to https://www.googleapis.com/drive/v2/files:

{ "error": { "errors": [ { "domain": "usageLimits", "reason": 
"dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use 
Exceeded. Continued use requires signup.", "extendedHelp": 
"https://code.google.com/apis/console"; } ], "code": 403, "message": "Daily 
Limit for Unauthenticated Use Exceeded. Continued use requires signup." }}

And this is the code - never mind the weird JS syntax, this is still using 
the Java API:

var scopes = new java.util.ArrayList(); 
scopes.add("https://www.googleapis.com/auth/drive";); 
var appIdentity = AppIdentityServiceFactory.getAppIdentityService(); 
var accessToken = appIdentity.getAccessToken(scopes);
var url = new URL("https://www.googleapis.com/drive/v2/files";); 
var connection = url.openConnection(); 
connection.setDoOutput(true); 
connection.setRequestMethod("GET"); 
connection.addRequestProperty("Content-Type", "application/json"); 
connection.addRequestProperty("Authorization", "OAuth " + accessToken.
getAccessToken());

Funny thing is that if I simply change the API to use the urlshortner API 
instead, it works:

var url = new URL("https://www.googleapis.com/urlshortener/v1/url/history";);

And output:

{ "kind": "urlshortener#urlHistory", "totalItems": 0, "itemsPerPage": 30}

What am I missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/v2la6ZNMAsMJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to