I have two public folders in my google drive and I want my app to be able read images from one folder and read and write images to another folder. Is there a way to do this using the google api or any GET method and hopefully without needing to authorize or authenticate the user’s google account? Thank you!
I’m pretty sure you’ll have to use authentication for writing.
Have you looked through the marketplace?
I can’t think of any storage service you can write to w/o authentication, but reading can be done on a AWS S3 bucket that was marked ‘public’.
Note: You really don’t want to have write-able target anywhere that doesn’t require authentication. Bad-actors will use it for their own purposes and you’ll end up paying for it somehow. It is just a bad idea.
You can set up a unsecured S3 bucket on AWS or a poorly secured slice on Digital Ocean and it will be discovered in seconds. The bad-actors out there know the address ranges of AWS and other major providers and troll them all day long using automated mechanisms. So, don’t believe for a second you won’t get hacked.
Thanks for your response but I was asked for this project to use a google drive folder, I’m perfectly fine with removing the write feature, that was just my own idea, so then is there a way to just read images from the folder? maybe as a Json of download links or something? I know I can get data from a public google sheet or calendar without any form of authentication, so I wanted to know if the same is possible with a google drive folder. Thanks!
You said you wanted to download images right?
Step 1. Figure out how to set this up so that simply typing the URL into a browser will download and/or show the image in the browser. (without having logged in or authenticated).
Step 2. Use that same URL with this function: https://docs.coronalabs.com/api/library/network/download.html
Step 3. When the download is complete, use the image.
The same applies to all other file types.
PS - Don’t forget, Android and iPhone both have build.settings required for networking and in the case of iPhone if you’re reading http and not https links, you have to set up ATS.
https://docs.coronalabs.com/guide/hardware/appleATS/index.html
It was more of downloading and showing all images in a specific folder, would this still work?
You need someway to know the file names. You can’t simply go to a GoogleDrive (or other) folder and get the file names like this.
You need to use a library (i.e. a plugin).
Again, go take a look in the marketplace. Your best bet is to use one of the plugins there AND you are going to have to bite the bullet and deal with authenticating. I’m not sure why you don’t want to, but the plugins will have APIs for doing it on whatever service the plugin is for.
If you don’t mind dealing with this entirely manually, then yes you could:
-
Set up a AWS S3 bucket. (You may need someone to give you 1:1 help with this. I don’t know your level of expertise.)
-
Write a index file with the names of the files in it. Formatted as plain text of a JSON encoded table.
-
Add the files to the bucket.
-
Then later… download the index file, do some string magic… download the files, one by one.
I’m pretty sure you’ll have to use authentication for writing.
Have you looked through the marketplace?
I can’t think of any storage service you can write to w/o authentication, but reading can be done on a AWS S3 bucket that was marked ‘public’.
Note: You really don’t want to have write-able target anywhere that doesn’t require authentication. Bad-actors will use it for their own purposes and you’ll end up paying for it somehow. It is just a bad idea.
You can set up a unsecured S3 bucket on AWS or a poorly secured slice on Digital Ocean and it will be discovered in seconds. The bad-actors out there know the address ranges of AWS and other major providers and troll them all day long using automated mechanisms. So, don’t believe for a second you won’t get hacked.
Thanks for your response but I was asked for this project to use a google drive folder, I’m perfectly fine with removing the write feature, that was just my own idea, so then is there a way to just read images from the folder? maybe as a Json of download links or something? I know I can get data from a public google sheet or calendar without any form of authentication, so I wanted to know if the same is possible with a google drive folder. Thanks!
You said you wanted to download images right?
Step 1. Figure out how to set this up so that simply typing the URL into a browser will download and/or show the image in the browser. (without having logged in or authenticated).
Step 2. Use that same URL with this function: https://docs.coronalabs.com/api/library/network/download.html
Step 3. When the download is complete, use the image.
The same applies to all other file types.
PS - Don’t forget, Android and iPhone both have build.settings required for networking and in the case of iPhone if you’re reading http and not https links, you have to set up ATS.
https://docs.coronalabs.com/guide/hardware/appleATS/index.html
It was more of downloading and showing all images in a specific folder, would this still work?
You need someway to know the file names. You can’t simply go to a GoogleDrive (or other) folder and get the file names like this.
You need to use a library (i.e. a plugin).
Again, go take a look in the marketplace. Your best bet is to use one of the plugins there AND you are going to have to bite the bullet and deal with authenticating. I’m not sure why you don’t want to, but the plugins will have APIs for doing it on whatever service the plugin is for.
If you don’t mind dealing with this entirely manually, then yes you could:
-
Set up a AWS S3 bucket. (You may need someone to give you 1:1 help with this. I don’t know your level of expertise.)
-
Write a index file with the names of the files in it. Formatted as plain text of a JSON encoded table.
-
Add the files to the bucket.
-
Then later… download the index file, do some string magic… download the files, one by one.