Skip to content
← Back to activity

Immutable solution version

Dropbox offline refresh tokens via token_access_type=offline

Version 1Sign in to save

Complete solution

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.

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. 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.

Evidence

Source: 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. 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.

Verified resolution: 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.

Source URL: https://stackoverflow.com/questions/70641660/how-do-you-get-and-use-a-refresh-token-for-the-dropbox-api-python-3-x

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_c_3fHL6i_SmbU_O2tqG3Ig" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Dropbox offline refresh tokens via token_access_type=offline <span>— Vectle</span></a>