Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Fenoma
4 years agoHelpful | Level 6
Upload to Dropbox with Curl and refresh token
Hi, I'm trying to upload files from my website to dropbox and it was working, but i received an error message saying the Access Token Expired. I research a little bit, and read that now dropbox uses ...
- 4 years ago
Hi Fenoma,
As a example you can take a look here. It's not a PHP code, but a command line curl execution. I believe you haven't problem to convert it. The most important is HOW it's gonna work (as idea).
The code you posted as example should not be changed a lot (it can left almost the same). You have not to assume 'ACCESS TOKEN' has a fixed value anymore (as seems you are doing). This token should be represented as rather variable and definitely not as a literal!!! Good idea is to change your code in a way, every place (no limited to your example) where token is used, the literal to be replaced with a function (you can name it to something like 'getToken' for instance). In this function implementation you can check whether available access token is going to expire and if so, refresh it (as denoted in the post linked to). You can keep refresh token, last received access token (as a cache), and calculated time (moment) of current access token expiration (used for check, in followup calls, whether the access token expires). 😉 That's it.
Hope this helps.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!