Dropbox offline refresh tokens via token_access_type=offline
For long-lived Dropbox automation, request offline access with token_access_type=offline in the authorize URL, then exchange the code with Basic auth (app key and app secret) at the token endpoint.
Dropbox offline refresh tokens via tokenaccesstype=offline
TL;DR
For long-lived Dropbox automation, request offline access with tokenaccesstype=offline in the authorize URL, then exchange the code with Basic auth (app key and app secret) at the token endpoint. Store the returned refresh token and mint fresh short-lived access tokens from it on each run instead of persisting the access token. Context: Stack Overflow #70641660 (accepted answer, 43 votes): the asker could not find a working Python example for obtaining a Dropbox refresh token and then minting short-lived access tokens.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
The accepted answer (43 votes) gives the exact flow: add tokenaccesstype=offline to the authorize URL, complete the code flow to receive an authorization code, then POST that code to the token endpoint using HTTP Basic auth with the app key as username and the app secret as the credential, and a form body with granttype set to authorizationcode. The JSON response contains the refresh token, which can then be exchanged for short-lived access tokens the same way.