cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know all about tools for creatives that work seamlessly with Dropbox, like Adobe? Well, check it out right here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android: How can I download file with my custom Download manager using bearer access token?

Android: How can I download file with my custom Download manager using bearer access token?

Andj
Explorer | Level 3

I'm creating an app that help user download their from from their cloud drives (Dropbox, Google Drive). I create an download manager to let user download, pause, resume, eta, speed...

So, how can I get the direct download link to a file in Dropbox to download it with the granted access token?

With Google Drive, I can by setting the request header

"Authorization" to "Bearer <access_token>"

I read the Dropbox API but could not find any info about this.  I don't use the API to create file shared link, because when loading the files list for user to choose to download, create share link for all of them are impossible (take long long time) and users don't want to share files. 

Please help!

1 Accepted Solution

Accepted Solutions

Re: Android: How can I download file with my custom Download manager using bearer access token?

Greg-DB
Dropboxer

To download a file directly from a connected account using the Dropbox API, you can use the /2/files/download endpoint. In the official Dropbox Java SDK, that's available the download methods.

Or, to get a temporary direct link to a file, you can use /2/files/get_temporary_link, which is getTemporaryLink in the Java SDK. 

Either way, you authorize the call by setting the user's access token in the "Authorization" header like you described. If you're using the Java SDK, it will build the header for you.

The difference is that the /2/files/download endpoint will return the file data directly in the response, whereas the /2/files/get_temporary_link endpoint will return a temporary link to the data in the response. You can then use that link to download the data however desired, without using the access token.

View solution in original post

2 Replies 2

Re: Android: How can I download file with my custom Download manager using bearer access token?

Greg-DB
Dropboxer

To download a file directly from a connected account using the Dropbox API, you can use the /2/files/download endpoint. In the official Dropbox Java SDK, that's available the download methods.

Or, to get a temporary direct link to a file, you can use /2/files/get_temporary_link, which is getTemporaryLink in the Java SDK. 

Either way, you authorize the call by setting the user's access token in the "Authorization" header like you described. If you're using the Java SDK, it will build the header for you.

The difference is that the /2/files/download endpoint will return the file data directly in the response, whereas the /2/files/get_temporary_link endpoint will return a temporary link to the data in the response. You can then use that link to download the data however desired, without using the access token.

View solution in original post

Re: Android: How can I download file with my custom Download manager using bearer access token?

Andj
Explorer | Level 3

Thank you, Greg! I have tried your suggestion using /files/download endpoint and it work perfectly.

Poll
Do you work or study in the creative industry? If so, which area?
If you use Adobe, don't forget to check out our latest integrations update here.
Who's talking

Top contributors to this post

  • User avatar
    Andj Explorer | Level 3
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?