1

I'm using Kloudless file explorer, and am retriving the bearer_token.

What I want to do is to get a token to use with the storage provider (dropbox for example). I want the ability to use its SDK initiated by the given token.

The reason is that after I use the file explorer, I want to download the selected folder from the server side.

Kloudless SDK doesn't support this scenario (yes, the relevant HTTP POST request is described in the documentation, but I rather use an SDK).

So the question is how to get dropbox (or other storage provider) token to be used in dropbox's SDK.

var explorer = window.Kloudless.explorer({
app_id: 'iCZ_ICMy43H0NSoz0QbLvmyjzCHf2frAOPaBfWVgh9_vrFIM',
types: ['folders'],
**retrieve_token**: true,

});

https://github.com/kloudless/file-explorer

MichaelLo
  • 1,289
  • 1
  • 14
  • 26

1 Answers1

0

(I work at Kloudless)

The use of the retrieve_token parameter is correct. The data in the JS callback will contain the metadata of the folder selected, as well as the Bearer token of the account connected. You can then transmit this data to your server.

Once you have received the token on your server, you can recursively list all the contents of the folder via the folder contents endpoint, and then make an individual API request to download each file via the file download endpoint.

Does this accomplish what you need?

vinod
  • 2,358
  • 19
  • 26
  • Yes, thanks. It would be really great to have an SDK for these endpoints, recursively going over the folders is too much work. – MichaelLo Jan 24 '17 at 09:31
  • We do have some basic SDKs that might be helpful at https://github.com/kloudless. However, recursive traversal beginning at some folder path would still need to be implemented at the client-level at the current time. – vinod Jan 24 '17 at 10:21
  • what about other endpoints in dropbox's API? let's say I want to get the logged in user name from their API, how can I do that using the Kloudless flow? – MichaelLo Jan 24 '17 at 10:56
  • Arbitrary third-party endpoints can be accessed via the [Pass-through API](https://developers.kloudless.com/docs/latest/core#raw-data-and-the-pass-through-api-pass-through-api). Kloudless will return the response to the API request to Dropbox back to your application. Note that the account name specifically should already be accessible as the `account` attribute of the Kloudless Account object metadata, which is available by default after the user authenticates their account. – vinod Jan 24 '17 at 12:14