Forum Discussion

Acey1's avatar
Acey1
New member | Level 2
3 years ago

token is gone after refresh

so i'm working on a website that uploads images to a folder
and for the first day it works just fine nothing is wrong
then the day after when i tried it again
it says the access token is invalid
so i regenerated it
i tried again and it still says invalid
so i regenerated it again
and i refreshed the page
and now the access token is gone and asks me to generate a new one
i generated it and refreshed 3 more times
and every time its gone
idk why

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Acey1 wrote:
    ...
    and now the access token is gone and asks me to generate a new one
    i generated it and refreshed 3 more times
    ...

    Hi Acey1,

    Your explanation is not very clear. What you mean with generated it? Also, what exactly you have refreshed? Refresh is automatic process!

    Regular access token is valid for 4 hours only. After that it could be "refreshed" with refresh token acquired on initial authentication. Have you received refresh token? Did you use it on your refresh or you mean something else?!

    Probably you got confused by "advertisement" of already dropped long time access token feature. Despite issued earlier long time access tokens can still be used, new issued tokens are no longer "long time". Just take this in mind and use the refresh token instead.

    Hope this gives direction.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Acey1 It sounds like you're using the "Generate" button on the app's page on the App Console to create a new access token. Note that this now only creates "short-lived access tokens", which do expire after a short period of time. Also, note that if you leave or refresh that page, the previous access token will no longer be shown there. It is only shown when you Generate it so you can copy it to wherever you need it.

     

    For reference, Dropbox is in the process of switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here.

     

    Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation.

     

    For reference, while the creation of new long-lived access tokens is now deprecated, we don't currently have a plan to disable existing long-lived access tokens. (If that changes, we will of course announce that ahead of time.) That being the case, you can continue using existing long-lived access token(s) without interruption, if you have any. Also, note though that after the change you won't be able to create new long-lived access tokens.

     

    While the change began on September 30th 2021, we're releasing it gradually, so you may not have seen your app(s) affected until now. Once it applies to your app, it would apply regardless of the "Access token expiration" setting for your app, and that setting may no longer be available for your app.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,940 PostsLatest Activity: 24 hours ago
350 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!