cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Short lived access token on new account - serverless function

Short lived access token on new account - serverless function

katec3
Explorer | Level 3
Go to solution

I have a serverless function that accesses a Dropbox app folder using the access token generated in the app console to downloads files. It is triggered through a push notification from Dropbox. This happens in the background with no user interaction. I have been developing using my own Dropbox account and have had no problem with the token expiring. I've now switched to a different gmail email address used by the project I'm developing for and created an app in the same way. This time I get a token prefixed with 'sl' that expires. I've followed the instructions here: https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Tokens-only-valid-for-4-hours-from-app-... But still get an 'sl' prefixed token that expires. Please can anyone advise why I'm getting different types of tokens between the 2 accounts and how to get a long life token? Alternatively, is there any way to refresh a token through a serverless function. Many thanks.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

You can get a refresh token via the OAuth app authorization flow and store and re-use that server-side without any further manual user interaction if you wish. 

 

As for the short-lived access token you're getting, it sounds like you may be using the "Generate" button. That only enables you to easily get access tokens, not refresh tokens. If you do want a long-lived access token from that, you'd need to set the "Access token expiration" setting to "No expiration" before generating the access token.

 

In any case, I recommend first reading the OAuth Guide and authorization documentation for reference first to see how these work. If something then isn't working as expected, please post here to show the part that isn't working and we'll be happy to take a look. For instance, post the code and unexpected output, etc. Don't post any access/refresh tokens or app secrets themselves though.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

You can get a refresh token via the OAuth app authorization flow and store and re-use that server-side without any further manual user interaction if you wish. 

 

As for the short-lived access token you're getting, it sounds like you may be using the "Generate" button. That only enables you to easily get access tokens, not refresh tokens. If you do want a long-lived access token from that, you'd need to set the "Access token expiration" setting to "No expiration" before generating the access token.

 

In any case, I recommend first reading the OAuth Guide and authorization documentation for reference first to see how these work. If something then isn't working as expected, please post here to show the part that isn't working and we'll be happy to take a look. For instance, post the code and unexpected output, etc. Don't post any access/refresh tokens or app secrets themselves though.

katec3
Explorer | Level 3
Go to solution

Many thanks @Greg-DB , much appreciated

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    katec3 Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?