Hey! @leonidas.petrou4 The best way to do this is by using Javascript SDK as I mentioned before.
As @neerja suggested, you need to create a custom plugin (you need javascript knowledge to do this).
I created a piece of javascript code that should do what you trying to do:
That is awesome. Thanks @yusaney1 I really appreciate it. This is a good starting point for me as I have no Javascript experience. Do you know how to do the same thing with the difference that the file gets uploaded into the current user’s Dropbox account?
Would you also mind please sending me a link to the editor so I can see how you set it up? I assume you used the Toolbox plugin.
No Toolbox or any other external plugin. That screenshot is from plugin editor.
About your question, actually, you can upload to any Dropbox account as soon as you have the API-key. In this case, I’m using my API-key but you can change the field using dynamic value:
About the editor, even if I send you the link you will not see anything because the code that uploads is not visible (which is visible in the first screenshot).
Thanks @yusaney1 , so I’ve managed to create the “upload_to” Element action - triggered in workflows where I added in your code. I then added the dropbox_key and dropbox_path in the fields and defined their types. I did all this in the “Elements” tab in the plugin editor. I have managed to authorise the private plugin and install it in my app. However, I think I am still missing a part of the plugin setup. Specifically, where do I define the file to be uploaded? I.e. where do I reference the file uploader / the file to be uploaded.
For anyone interested, this was @yusaney1’s Javascript plugin solution (see screenshots below).
He was kind enough to help me get this working. This works great to upload files to one Dropbox account (the account of the generated token) but not to each user’s private Dropbox account. Unless users create their own Dropbox developer accounts, app and token which they would then input into my app. This can work, but it is not a seamless user experience and will be tough for non-technical users. So unless we use User Authorisation, this problem remains unsolved
I can only see this solution being solved in one of two ways:
The Bubble team fix the API connector to allow POST calls with user-agent flow. Any update on this @neerja? Or,
Use Javascript to set up a Dropbox User Authorisation Plugin, which I have no idea how to do.
Hi @leonidas.petrou4, as told you this morning the code uploads files using Access token. The OAuth process gets that Access token when you log-in with your Dropbox account and link’s to app-folder-project.
However, this is what you want, an OAuth sign using Javascript SDK:
I was able to make it work without any plugin and js sdk.
The first step is to use a link to the authorize and redirect to another page when user accept (this is the redirect uri). In this page keep it empty, but create a flow on page load that will grab the CODE from url. Call the Token endpoint to get access token, store it with user. Authenticate with access token with all other call.