cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We've been busy working on some major updates to the Community, so check out what's changing, what’s staying the same and what you can expect from the Dropbox Community 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: 

Expired Access Token

Expired Access Token

sunilgeechoo
Explorer | Level 3

Hi,

 

We are creating app and generating token by clicking on Generate button, it is always getting expired and we need to generate new one. we are creating app in app console (https://www.dropbox.com/developers/apps) and generated tokens always starts with "sl."

5 Replies 5

Здравко
Legendary | Level 20

Hi @sunilgeechoo,

Using long lived access token is deprecated and creation of new is already dropped. That's why you're getting short lived token only. Alternative for long term access is refresh token. You have to adapt your application to use such token type. For possible way of refresh token creation, take a look on https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Issue-in-generating-access-token/td-p/5....

Hope this helps.

sunilgeechoo
Explorer | Level 3

Hi,

 

Do i need to create tokens every time after it get expired? We are using it for display images and files in our application. Each time should we create new tokens?

Здравко
Legendary | Level 20

No, refresh token doesn't expire itself. It's long lived and can only be revoked by the application or by user on demand.

sunilgeechoo
Explorer | Level 3

Hi,

 

after generating refresh token using below 

https://www.dropbox.com/oauth2/authorize?token_access_type=offline&response_type=code&client_id=<App key>

 after few minutes i tried to generate access token using curl php, but it is showing string(90) "{"error": "invalid_grant", "error_description": "code has expired (within the last hour)"}"  

Здравко
Legendary | Level 20

Hi ageing @sunilgeechoo,

I'm not sure what actually you have done, but if you stopped after browser generated code... it's just a code, not refresh token, as you might thought. This code can be used one time for refresh token generation and for nothing else! As seems you haven't done it or trying multiple times (I speculate here).

To discuss your issue, present passed workflow, you have done, in  more consistent way so to be clear what's the actual state and what can be done next. Maybe would be helpful exact sequence of steps up to refresh token generation (they are 2 actually) and a code snippet showing the place where you get error. Most probably you have moved second step for refresh token generation in your regular application code flow, something erroneous if unintentional. Make a note that I grouped my post, referred before, in paragraphs. Don't split commands residing in one paragraph.

Hope this gives additional direction.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    sunilgeechoo Explorer | Level 3
What do Dropbox user levels mean?