Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I'd like to use dropbox as a remote storage center for some text files created by a deployed Shiny app. I need web users to be able to submit to a form which writes these files back to dropbox. In RStudio, I installed rdrop2, but I'm having trouble getting permanent remote access in the account which I set up for the storage. I ran
token <- drop_auth()
saveRDS(token, file = "<savelocation>.rds")
and can find the token file on my computer. However all I did was add dtoken = token into my other code using the token from the global environment. Everything worked as expected until I tried to pick it up the next day again, by which I had lost authorization. Now when I try I'm getting: Warning: Error in drop_upload: Unauthorized (HTTP 401). I think this is because the token expired, but I don't understand how to get a refreshing token despite reading other posts here. I can't even authorize it anymore and get it to work like the first time.
Another solution I heard of was copying the httr-oauth file into the working directory. Would this be a better idea? If so, how would I do it.
Thanks!
Hi @sydneyfr,
Long lived access token is deprecated already long time ago. In spite existing long lived tokens can still be used as such, all new issued access tokens are short lived! To keep long term access, you need to handle token refresh using refresh token. If you're using official SDK, refreshing gets internally, while if you use you own implementation take a look here, for instance.
Hope this gives direction.
@sydneyfr Здравко is correct; Dropbox is now issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. Short-lived access tokens expire after a short period of time, so you'd receive a 401 expired_access_token error when attempting to use a short-lived access token that has expired. 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. There's a basic outline of processing this flow in this blog post which may serve as a useful example.
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.
Dropbox can't offer support for RStudio/rdrop2/drop_auth in particular as those aren't made by Dropbox, so you may want to refer to the support resources and documentation for those for information on what functionality they support for this.
Hi there!
If you need more help you can view your support options (expected response time for a 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!