I'm developing client application based on Javascript that won't be a Google App. I can create files on Drive but have a problem with a authorization when trying to upload the content.
A comment in: Authorization of Google Drive using JavaScript seems to say that the client must be a google App to write to Drive but until I saw this comment I thought this was possible reinforced by my ability to create empty files. Please will somebody clarify this?
I'm using code similar to response 3 of the post however I only get the login screen nothing asks for Google Drive permissions.
My code uses the 2 part "media" upload method described in How do I add/create/insert files to Google Drive through the API?
As I say the file create works but the upload fails:
PUT https://www.googleapis.com/upload/drive/v1/files/0Bxbwly1hLFXnVmQ3Snh3ZXVOYVE?uploadType=media&alt=json&key= 401 (Unauthorized) rs=AItRSTNkdxHWOPN1C6XNGC9ea3U4KWDICw:128 :response>{"error" {"message" "Invalid Credentials", "errors" [{"domain" "global", "reason" "authError", "message" "Invalid Credentials", "locationType" "header", "location" "Authorization"}], "code" 401}}
I'm not using Javascript direct rather Clojurescript so it is possible there is a problem with my upload call. The lack of anything asking for Google drive permissions would seem to indicate a real authorization problem but then I would have expected not to get an access_token when requesting "https://www.googleapis.com/auth/drive". Thanks
Update.... I've finally solved this: If I request "https://www.googleapis.com/auth/drive.file" rather than the greater privileges "https://www.googleapis.com/auth/drive" then the authentication requests access to Drive and the file content is uploaded.