Android Backup Service

You should make a plugin :slight_smile:

Also on authorization, ping me I think a have modified auth2 Lua file on Dropbox some where where I used googles services( scottrules44@gmail.com). I would share it with everyone but oauth2 is a paid product.

Dear Scott,

Thanks for your answer.

I have bought the oAuth2 Extension. But it don’t comes with the configuration values to use with Google Drive. I’m reading all the Google Drive API Documentation and it is terrible…  :wacko:

I think this extension can be used with all sites that uses OAuth2 to connect (Google Drive, DropBox, BufferApp, Foursquare, Smartthings, GumRoad, …) but appear that different sites has different variables. I can’t found Google Drive configuration.

I registered for the OAuth2 in Google Drive for my app, and download a son file that contain the following values:

{ā€œinstalledā€:{ā€œclient_idā€:"<myClientId>",ā€œproject_idā€:"<myProjectId>",ā€œauth_uriā€:"https://accounts.google.com/o/oauth2/auth",ā€œtoken_uriā€:ā€œhttps://accounts.google.com/o/oauth2/tokenā€,ā€œauth_provider_x509_cert_urlā€:ā€œhttps://www.googleapis.com/oauth2/v1/certsā€,ā€œclient_secretā€:"<secret_Client>",ā€œredirect_urisā€:[ā€œurn:ietf:wg:oauth:2.0:oobā€,ā€œhttp://localhostā€]}}

How can I use this with the oAuth2 extension I have bought?

I see other values to set there like:

– BufferApp

url_authorization_buffer = "https://bufferapp.com/oauth2/authorize"

url_access_token_buffer = "https://api.bufferapp.com/1/oauth2/token.json"

url_access_profiles_buffer = "https://api.bufferapp.com/1/profiles.json"

url_user_buffer = "https://api.bufferapp.com/1/user.json"

client_id_buffer = ā€œ<Client ID>ā€

client_secret_buffer = ā€œ<Client Secret>ā€

:frowning: Terrible… Any suggestion?

Thanks again to all. If I can perform a widget I will share for sure. I’d love to perform an easy widget that can support Google Drive, DropBox… only to write and read for the application folder, and easy to use, for sure, depending of the oAuth2 extension that need to be buy. But I can perform a widget with can be used like the follow:

local gDrive = widget.googleDriveNew(…)

gDrive.putFile (file)

gDrive.getFile (file)

for sure, with dependency of the oAuth2 extension.

Any help?

Thanks again…

my email is cnksoftware@gmail.com

:wacko:

First off just done on vacation, second let me take a look

:wink: Thanks very much dear.

If I find any I will let you know too.

Regards,

Just a quick update, i did have lots of success. The biggest problem is uploading files. Google is very specific on how the want multipart data and corona does not support multipart data. Thier is a module made long ago (class_multipartData.lua), which does not meet googles requirements. So I have to do lots of modification.

Update 2: google drive plugin is complete, now working on documentation and sample.

Dear ScottĀ” good news. Excellent job. Dear, where can i find your sample and documentation? Possible to share it? Thanks again!

Here is docs and example
https://scottrules44.com/plugin#GoogleDrive
ā€œBut scott where is the pluginā€
Glad you asked, it is currently on its way to the corona marketplace for the low price of free.

Wow, thanks so much for your excellent job and very quick answer. I’m going to check it. Amazing dear. Thanks again!

Dear Scott, any news about the plugging? I’m in expectation for it.

I was reading at your web and it must be amazing.Ā 

Do you know if it will last many time to publish in Corona Plugging Store?

Thanks again dear, Great Job!

Corona is making some updates to their marketplace, I have pokeing corona as much as I can to try to get this plugin out. I submitted July 11.

Dear Scott. Again, thanks for your excellent job. I will continue awaiting it.

Thanks a lot again.

Regards

Wait no more
http://marketplace.coronalabs.com/plugin/google-drive

Dear Scott,

Fantastic !!. Thanks so much a lot for your excellent job.

I’m going to use it following your well done guides.

Thanks again. Great job.

Dear Scott, its fantastic. I have tested your example and followed your detailed info and works fine.

Only I don’t know how to copy files to an specific folder at Google Drive. I will use this extension for a backup of a user data file (in zip format) for my app. DropBox allow to write only to the App directory. With this extension I have access to all the user root files. I only need to save restore backup file from/to an App folder, or, create an specific folder to save the App data and not disturb or write to the root directory to avoid the user can delete accidentally the backup file.Ā 

It is possible to create a folder and copy the file to that folder?

I don’t find the way to only have access to Apps folder (if it exist in Google Drive).

Any suggestion?

Thanks for your excellent job dear. You did it perfect !!!

I need to make some change to the plugin hold on

This has been added seehttps://scottrules44.com/plugin#GoogleDriveIt is at the bottem, please sign out first Add drive.onlyAppAccess(true). This require a re sign in and this should be declared before calling drive.login

I have not tested yet, I will fix it if it needs it but it should work

Dear Scott, thanks again for your excellent work.

I’m testing with it. I have add

drive.onlyAppAccess(true)

before drive.init and ok

but, now, when try to upload a file, I have the error:

ā€œ{\n ā€œerrorā€: {\n Ā ā€œerrorsā€: [\n Ā  {\n Ā  Ā ā€œdomainā€: ā€œglobalā€,\n Ā  Ā ā€œreasonā€: ā€œinsufficientFilePermissionsā€,\n Ā  Ā ā€œmessageā€: ā€œThe user does not have sufficient permissions for this file.ā€\n Ā  }\n Ā ],\n Ā ā€œcodeā€: 403,\n Ā ā€œmessageā€: ā€œThe user does not have sufficient permissions for this file.ā€\n }\n}\nā€

I think it is the credentials. I have no way to configure the corrects credentials in google drive.

I used this:

local fileName = ā€œarrowā€

drive.request(ā€œhttps://www.googleapis.com/upload/drive/v3/files/ā€, ā€œPOSTā€, function ( e )

print(json.encode(e.response))

end, {uploadType= ā€œmultipartā€}, {parent = ā€œappDataFolderā€, name = fileName}, fileName…".png", system.ResourceDirectory, ā€œimage/pngā€, fileName )

but the answer is:

ā€œ{\n ā€œerrorā€: {\n Ā ā€œerrorsā€: [\n Ā  {\n Ā  Ā ā€œdomainā€: ā€œglobalā€,\n Ā  Ā ā€œreasonā€: ā€œinsufficientFilePermissionsā€,\n Ā  Ā ā€œmessageā€: ā€œThe user does not have sufficient permissions for this file.ā€\n Ā  }\n Ā ],\n Ā ā€œcodeā€: 403,\n Ā ā€œmessageā€: ā€œThe user does not have sufficient permissions for this file.ā€\n }\n}\nā€

if I disable the new option you prepared ( --drive.onlyAppAccess(true) )

then create a file but no way to create at the appDataFolder.

Any idea?

Thanks again.

Ā 

I am looking at this right now