Google Drive

Try setting mimeType to application/zip

No success. I will keep on trying later. I think file has been base-64 encoded, and embedded into a plain (application/json???) file…

I’ll post if i am able to get it.

By the way, this is content of uploaded file:

–MPFD-c7438d84ddfd075629f3b83aaf5fee687407b7a2

Content-Type: application/json; charset=UTF-8"

{“name”:“prueba”}

–MPFD-c7438d84ddfd075629f3b83aaf5fee687407b7a2

Content-Type: application/json; charset=UTF-8"

{“parents”:[“appDataFolder”]}

–MPFD-c7438d84ddfd075629f3b83aaf5fee687407b7a2

content-disposition: form-data; name=“prueba”; filename=“prueba.zip”

Content-Type: application/zip

Content-Transfer-Encoding: base64

UEsDBBQAAAAIAHucHUkv2b59JR4AAIoeAAAOAAAASWNvbi02MEAzeC5wbmdVWQVUlO0SRkBEBKSk

c5HullaWFlhSumFZQEK6+UE6pGspaZYUpEFAlu5OCelwaRCQuN9/89w9O7tnz35vzTwz88y8kepq…

(here continues all base-64 encoded zip file)

I’ll take a look when I get to my computer

I just did a working test

Screen%20Shot%202016-08-31%20at%201.09.0

local fileName = "test.zip" drive.request("https://www.googleapis.com/upload/drive/v3/files/", "POST", function ( e ) print(e.response) end, {uploadType= "multipart"}, {name = fileName}, fileName, system.ResourceDirectory, "application/zip", fileName )

Windows support added for web view added in the recent daily builds.

Dear Scott,

I think this is the correct place to speak about this plugging and possible bugs.

1st. Will this plug support the new policies for Google for the next April 20th ?

(https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html)

The rollout schedule for the deprecation of web-views for OAuth requests to Google is as follows. Starting  October 20, 2016 , we will prevent new OAuth clients from using web-views on platforms with a viable alternative, and will phase in user-facing notices for existing OAuth clients. On  April 20, 2017,  we will start blocking OAuth requests using web-views for all OAuth clients on platforms where viable alternatives exist.

  1. All names for the files uploaded to the application folder lost his own name, and change to ‘Untitled’. This make impossible to get the correct ID for the file we need to download.

 

EXAMPLE:

 

drive.request(“https://www.googleapis.com/drive/v3/files/”, “GET”, function ( e ) 

print(e.response)

end, {spaces= “appDataFolder”} )

 

 

GIVES THIS ANSWER (I have uploaded 2 files)

 

 

{

 “kind”: “drive#fileList”,

 “files”: [

  {

   “kind”: “drive#file”,

   “id”: “1gi4QMQ12wZkI1wMcBic1OgM8cHLpZhqk37-2ZLhVn-KO”,

   “name”: “Untitled”,

   “mimeType”: “application/octet-stream”

  },

  {

   “kind”: “drive#file”,

   “id”: “11uoK3859IMBFeYtRp4SgixXrOe7klttXXudpbwfX0_6X”,

   “name”: “Untitled”,

   “mimeType”: “application/octet-stream”

  }

 ]

}

 

 

Note that the name is ‘Untitled’ for both files. Not possible to identify the correct file to download.

 

I think this is a bug dear.

 

 

  1. Is there any way to create folders to upload files to?

Google explain that need to change the mimeType to

mimeType = “application/vnd.google-apps.folder”

 

But I have been testing and the mime type always is the same. Any way to create folders by this way or other?

 

 

 

Thanks again for your great job.

 

 

A lot of stuff there

let me try to break it down

  1. I not received anything on mac simulator, I am looking into this. I think iOS is the major problem. I will try to implement slowly as time goes along. 

as for the other stuff I just want to address that way plugin is, it is designed to allow access to the drive rest api. So this “bug” is not with plugin self, it is the way it’s used. It like making the comparison that the network api are broken because I am getting server errors. It could be networking apis, but it is mostly likely the way its being used or the server.

 I have been trying myself and I cannot get it working. I honestly know just as much as you do about every google drive api. I feel this google bug based on the way google drive documentation is written. 

Hi Scott,

Three things:

  1. I hope the Corona engineers will step in and talk about how they intend to deal with the deprecation of OAuth through WebViews, since I’m assuming you (like myself) use this method for authentication.

  2. I found the Google API Playground invaluable for making things work. The documentation in itself is far from enough to understand things and get them working. The API PlayGround is amazing and helps a lot.

  3. If you want, I can share my Google Calendar stuff with you, so you can see some of the REST and JSON trickery.

Thanks, for this.

  1. I don’t think they will, my guess is the web pop ups and safari web view for iOS will work. 

2/3. I understand how the api work, thanks for the offer, I made this plugin in my free time. The main goal of the plugin was to make it easier to use the google drive api. 

I have decide to open source this plugin btw https://github.com/scottrules44/google-drive-source

Hey Scott! Thanks - I saw your mail answering my other OAuth post as well. The native web-PopUp looks like a solution for my problem (depending on how well it’s implemented, but I’m hopeful!).

Very cool of you to open source your stuff. I will definitely share my calendar stuff as well, but at the moment (due to lack of time) all I can do is an undocumented code dump, and that might confuse more than it would help!

Just started trying to implement this.

I managed to log in ok, but when I restarted the app “drive.haveRefreshToken” is true so the webview doesn’t appear, but I am not logged in so can’t make any requests (get ‘not signed in’ error returned).

I cannot reproduce this, can you provide a sample

Is this plugin still current? The documentation link is not owrking.

https://scottrules44.com/plugin#GoogleDrive

It is no longer supported, source code is available 

https://github.com/scottrules44/google-drive-source

Thanks Scott. DO you have a sample Corona app using this?

Here is old sample

https://github.com/scottrules44/drive-plugin

Pretty sure plugin does not work anymore because Google wants you to sign in with native api. Which is why it is open source. If you get it working let me know.

I actually got it working to here but not sure where to go from here. How can I use this inside my app?

 If you got it to work that is great, I am not supporting this plugin anymore

  1. If you want, I can share my Google Calendar stuff with you, so you can see some of the REST and JSON trickery.

Can someone please tell me more about this?

Hello
Not sure if yo uare still active but if you still have this plugin up and running I would be very interested then :slight_smile: