We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
masonml
4 months agoNew member | Level 2
Refresh Token for Python Project
Hi all, I'm unfamiliar with APIs and this is my first project of this type so any help is appreciated. I've written a python code that uploads an image from a camera to my Dropbox app. The code w...
Greg-DB
4 months agoDropbox Staff
Dropbox is no longer offering the option for creating new long-lived access tokens. Dropbox is now 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. Refresh tokens do not expire automatically and can be used repeatedly. 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.
Also, note that you do not need to implement the refresh process yourself. The Dropbox Python SDK will handle that logic for you as long as you pass the refresh token, app key, and if needed (when not using PKCE), app secret to the Dropbox client. The code you used does not request a refresh token. Instead, for the official Dropbox Python SDK, you can find examples of how this works with refresh tokens at the following links:
- https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-scopes.py
- https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-pkce.py
As for the SSL error you mentioned, that seems to indicate an issue establishing a secure connection to the Dropbox API servers from that computer. Check for anything on that computer, such as a VPN, proxy, firewall, or other security software that may be interfering with your network connection.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 hours agoIf 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!