cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We're looking to hear about your experience when using Dropbox in a web browser. What parts of Dropbox feels very slow to you and takes a lot of time to get done? What are you trying to do in the Dropbox web browser when you experience slowness? Tell us 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: 
1
Ask
2
Reply and help

the easiest way for users to access data on one (joint) account via API - access token

the easiest way for users to access data on one (joint) account via API - access token

Polas
Explorer | Level 4

I'm a beginner and I'm lost when working with authorization token. I have a desktop application that users will use to access my files (occasional access to small dials). The software is written in DELPHI. API testing with test token generation (valid for 4 hours) works great, but I can't move forward. I thought it was enough to replace the test temporary token with the app generated token (see pic), but it doesn't work that way. Can you please give me the EASIEST way to make files in my dropbox account available to users? Ideally, a simple example. Thank you very much.

 

2023-01-16_07h09_52.png

5 Replies 5

Re: the easiest way for users to access data on one (joint) account via API - access token

Здравко
Super Collaborator | Level 20

Hi @Polas,

At present all new access tokens are short-lived (as you noted up to 4 hours - 14400 seconds at most). The old long-lived access tokens are in retirement already. If by any chance you have such a token left, you still can use it, but new can't be created (leading "sl" - before the dot - means Short Lived). For long term access, without further end user activity, you have to use refresh token (offline access) that can be used to "refresh" the access token (i.e. regenerate it).


@Polas wrote:

... The software is written in DELPHI. ...


Unfortunately, There is no Delphi SDK, supported by Dropbox, and you have to call API end points using available HTTP tool in your environment. You can take a closer look about managing refresh token in the thread here. 😉

Good luck.

Re: the easiest way for users to access data on one (joint) account via API - access token

Greg-DB
Dropboxer

@Polas As Здравко said, for long-term access, you should request "offline" access to get a "refresh token". You can find more information in the OAuth Guide and authorization documentation, as well as this blog post.

 

Also, it sounds like you may want to have multiple users connect directly to your own specific Dropbox account via the API. Note that the API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. While it is technically possible to always connect to just one account for all users, we do not officially support this, for various technical and security reasons. To give others access to content in your account, you may want to use Dropbox sharing functionality instead.

Re: the easiest way for users to access data on one (joint) account via API - access token

Polas
Explorer | Level 4

I still can't, I've only progressed a bit:

1.  I asked for a code 

https://www.dropbox.com/oauth2/authorize?token_access_type=offline&response_type=code&client_id=ka23...

and I got <received code>

2023-01-26_07h52_31.png

the next step failed

2.  https://api.dropbox.com/oauth2/token -d code=<CODE_FROM_THE_IMAGE> -d grant_type=authorization_code -u <KEY_APP> : <SECR_KEY_APP>

2023-01-26_08h01_39.png

What am I doing wrong? is the syntax ok?

I'm sure both the app key and the secret key are fine. Please advise, thanks!

2023-01-26_08h05_25.png

 

Re: the easiest way for users to access data on one (joint) account via API - access token

Здравко
Super Collaborator | Level 20

@Polas, API calls can't get through the browser address line! Are you aware what's "curl"? 🧐

Hope this gives direction.

Re: the easiest way for users to access data on one (joint) account via API - access token

Greg-DB
Dropboxer

@Polas As Здравко noted, it appears you are attempting to use /oauth2/token in your browser, which won't work. Note that while /oauth2/authorize is a web page that the user would access in their browser, /oauth2/token is not; /oauth2/token is an OAuth endpoint that you would call programmatically.

 

For instance, the examples in the /oauth2/token documentation use curl to peform that call, but you can use any HTTPS client of your choosing.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    Здравко Super Collaborator | Level 20
  • User avatar
    Polas Explorer | Level 4
What do Dropbox user levels mean?
Need more support?