I'm building a Flask app that sends files users post on their account to a shared Dropbox folder. It works fine with these short-lived 4-hour tokens, but as I prepare to move to deployment I need a longer-lasting token. I got a refresh token but when I try to use it I get an invalid token exception. I did the following:
1. Used my browser to load the following, with my app key inserted.
https://www.dropbox.com/oauth2/authorize?client_id=APPKEYHERE&response_type=code&token_access_type=offline
2. Authorized the request in the browser, got back the access code.
3. Ran the following, inserting the code I just got in the previous step, as well as my app key and app secret:
curl https://api.dropbox.com/oauth2/token \
-d code=CODE_I_JUST_GOT_FROM_BROWSER \
-d grant_type=authorization_code \
-u APPKEYHERE:APPSECRETHERE
This returned what I expect—a dictionary with access token (the short-lived one starting with `sl.`), some account and permission info, and the `refresh_token`. When I use the short lived token it works (until expiration) but the refresh token gives me an error. What am I doing incorrectly? I've done the above process a couple of times now with no luck.