I would like to send private files through the API connector.
With the right privacy role set-up, these files should be sent “in clear” to the API connector, shouldn’t they ? .
But it’s not working : Bubble support says it’s not a bug it’s just a feature that is not supported !
So I’m looking at workarounds to be able to store files in a private and secured manner while being able to send them through the API.
The DropBox plugin doesn’t seem to be downloading correctly files from DropBox according to the documentation : I would be able to upload the files in DropBox, but not to retrieve them from DropBox to forward them to the API connector.
I was thinking about making the file “public” just for a couple of seconds while sending it to the API. I’ve found a way to convert a public file into a private file. But there don’t seem to be any ways to convert a private file into a public file.
I haven’t found any ways to copy or duplicate files in S3 either - that might have been another path to explore.
Any ideas or suggestions ? That would be a great help.
That’s what I did. But once the file is private it won’t go through the API connector. Even if the privacy rule say that the user can view the attached file.
Yes, but I’m not talking about this private option in the API connector ; the issue is about sending through the API connector private files, i.e. files that have been attached to a thing to control who can access it
Privacy rules do not work for backend logic. They are meant to allow or to limit data to be sent to the browser.
Perhaps creating a file object with a file field and a private? yes/no may help. Instead of having a field of type file in the object … have this file object in the object and use conditionality to private? yes.
So I hope this will help you guys.
So this is the only way I found (after a looot of time on this issue…)to send a private file through an API.
I generated a token in the Settings/API section.
Then before to use the encoded in base 64 function on the file you need to add the token into the file url by adding: /?api_token=xxxx
with “xxxx” the api token generated previously.
Here screenshots:
In the delimiter i add a “space”
Im currently building an app and my concept (although not implemented yet) is to upload the file publicly first, then store the file as base64 value in a text field of an object of type ‘file’ (or wherever a file is attached to a db entry) and then - if the file is needed to be transferred via API or somewhere else in the file - to write a file from base64 with this plugin: Bubble Back End Utilities Plugin | Bubble
In theory this should work although I’m not yet clear if it’s really ‘that easy’ to implement and how much compute it would consume.
I’ll keep you guys posted
Tried it, doesn’t work (or only with limitation of filesize max 6mb which is not very pleasing).
Pretty much only solution it seems is using Wasabi for file storage and restrict the access to the storage based on the url where the request comes from (aka your home url) (tip from @georgecollier )