I'm trying to do the worlds simplest node dropbox script but getting an error, clearly I am missing something.
I set up an App - and gave it all the read permissions.
Then I have this script which should list the contents of the root - which I assume would be the App folder name I setup:
```
import { Dropbox } from "dropbox";
import fetch from "node-fetch";
const clientId = "***";
const clientSecret = "***";
const config = {
fetch,
clientId,
clientSecret,
};
const dbx = new Dropbox(config);
dbx
.filesListFolder({ path: "" })
.then((response) => {
const entries = response.result.entries;
console.log("Contents of the root directory:");
entries.forEach((entry) => {
console.log(entry.name);
});
})
.catch((error) => {
console.error("Error listing contents:", error);
if (error.response) {
console.error("Error response:", error.response.data);
}
});
```
I have the correct id and secret entered when I run it, not ***
When I run it I get an error:
```
Error listing contents: DropboxResponseError: Response failed with a 409 code
at D:\Repos\locket-emailer\node_modules\dropbox\cjs\src\response.js:34:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 409,
headers: {
'accept-encoding': 'identity,gzip',
'cache-control': 'no-cache',
connection: 'close',
'content-length': '126',
'content-security-policy': 'sandbox allow-forms allow-scripts',
'content-type': 'application/json',
date: 'Sat, 23 Dec 2023 03:34:45 GMT',
server: 'envoy',
'x-content-type-options': 'nosniff',
'x-dropbox-request-id': '266f5a0735ac4753a45ad1bb0214e9c5',
'x-dropbox-response-origin': 'far_remote'
},
error: {
error_summary: 'path/unsupported_content_type/..',
error: { '.tag': 'path', path: [Object] }
}
}
```
Shouldn't this work? I read in another thread that the app permissions don't allow access to anything but in another place I read I should be able to access the apps folder which makes more sense to me.
All I want to end up with is a script I will run on a local computer on a schedule to get some shareable links - for my own files which will be in the apps folder.