I'm trying to get the contents of a file stored in Google Drive through JavaScript. I have been able to download the file manually just fine by pasting the URL (the webContentLink from the JSON response to a list query) in my browser. Their SDK doesn't support this natively (the get command only gives you the metadata), so I'm trying using jQuery, and running into a CORS issue even though I've set my site as the origin when I created my Google OAuth client ID & secret. My code is like:
$.ajax({
url: "https://docs.google.com/uc?id=0B-9B62bXdQ1nTFlwY0pveVgzOVU&export=download",
headers: {"Authorization": "Bearer " + gapi.auth.getToken().access_token}
})
I get a 405 Method not allowed error: https://docs.google.com/uc?id=0B-9B62bXdQ1nTFlwY0pveVgzOVU&export=download 405 (Method Not Allowed) jquery-2.1.1.min.js:4 XMLHttpRequest cannot load https://docs.google.com/uc?id=0B-9B62bXdQ1nTFlwY0pveVgzOVU&export=download. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mydomain.com' is therefore not allowed access.
According to this video, Google Drive should support CORS requests. But according to this bug, it is not working. Is there any way to do this without using a server-side proxy or some iframe hack?