I've just started playing around with the sdk, and been using the generated access token in the Settings. I realized this token expires every 4 hours, so I want to implement the refresh token.
https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&token_access_type=offline&response_type=code
I went through the auth steps by obtaining the Code, and then using that code in this curl command:
curl --location --request POST 'https://api.dropboxapi.com/oauth2/token' \
-u '<APP_KEY>:<APP_SECRET>'
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'code=<ACCESS_CODE>' \
--data-urlencode 'grant_type=authorization_code'
Lastly I use the refresh token like so:
const dbx = new Dropbox({
clientId: process.env.DBX_APP_KEY,
clientSecret: process.env.DBX_APP_SECRET,
refreshToken: process.env.DBX_REFRESH_TOKEN,
fetch,
});
const response = await dbx.filesListFolder({ path: "" });With the temporary Access token it works fine, but now with this refresh token I get a 409 error. It's clearly a permissions thing but I can't figure it out. Does it have anything to do with me creating the App on my account, adding my folders etc... then running the auth to get the code? Is it essentially "installing" the app again, but this time with nothing?
I'm out of ideas, thanks!