andreafabrizi / Dropbox-Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.56k stars 1.08k forks source link

Not working #598

Open skorzennik opened 3 months ago

skorzennik commented 3 months ago

I downloaded the version avail as of today, configured it and I can run

./dropbox_uploader.sh info
Dropbox Uploader v1.0

 > Getting info... 

Name:           Sylvain Korzennik
UID:            dbid:AADTdP59nd0DeTMad7Srt-dMtWE_D1KLNaA
Email:          skorzennik@cfa.harvard.edu
Country:        US

and

./dropbox_uploader.sh space
Dropbox Uploader v1.0

 > Getting space usage info... 

Quota:  2560 Mb
Used:   1569 Mb
Free:   990 Mb

but the following fails

 ./dropbox_uploader.sh list
 > Listing "/"... FAILED

I modified the script to dump the $RESPONSE_FILE and it says

HTTP/2 401 
content-type: application/json
cache-control: no-cache
content-security-policy: sandbox allow-forms allow-scripts
www-authenticate: Bearer realm="Dropbox-API"
x-content-type-options: nosniff
x-dropbox-request-url: /2/files/list_folder
date: Thu, 06 Jun 2024 20:56:03 GMT
server: envoy
content-length: 106
x-dropbox-response-origin: far_remote
x-dropbox-request-id: 7aafeb32e1a946cf84ca759e06bf7081

{"error":{".tag":"missing_scope","required_scope":"files.metadata.read"},"error_summary":"missing_scope/"}

Some error occured. rerun the script with "-d" option and check the output and logfile: /tmp/du_resp_29560.hpc.

any idea what is going on?

PS: here is the diff for my 'hack' 1- make RESPONSE_FILE unique per user (avoid perm denied if $TMP_DIR/du_resp_debug exists and own by diff user 2- cat its content when FAILED, to avoid -d that is way too verbose IM(H)O

< RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM"
---
> RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM.$USER"
146c146
<     RESPONSE_FILE="$TMP_DIR/du_resp_debug"
---
>     RESPONSE_FILE="$TMP_DIR/du_resp_debug.$USER"
603a604
>         cat $RESPONSE_FILE
686a688
>                 cat $RESPONSE_FILE
715a718
>                 cat $RESPONSE_FILE
778a782
>                 cat $RESPONSE_FILE
894a899
>         cat $RESPONSE_FILE
942a948
>                 cat $RESPONSE_FILE
980a987
>         cat $RESPONSE_FILE
1011a1019
>         cat $RESPONSE_FILE
1042a1051
>         cat $RESPONSE_FILE
1072a1082
>         cat $RESPONSE_FILE       
1102a1113
>         cat $RESPONSE_FILE       
1124a1136
>         cat $RESPONSE_FILE      
1211a1224
>         cat $RESPONSE_FILE
1403a1417
>         cat $RESPONSE_FILE
1424a1439
>         cat $RESPONSE_FILE
adwenn commented 3 months ago

I can also confirm that the script is not working anymore. @skorzennik This following error: {"error":{".tag":"missing_scope","required_scope":"files.metadata.read"},"error_summary":"missing_scope/"}

Did you properly configure the permissions in the dropbox developer page? if you do not check this permission files.metadata.read and files.metadata.write you will get this error. I'm a step further than this error here. I'm at the point that when I call the list command it will show me whatever is in my folder. I have chosen a folder scope. That works. But I cannot download or upload any files. It keeps failing.

I'm hoping that this project is not abandoned.

adwenn commented 3 months ago

Ok. I figure it out. It is working now. I was getting a 400 error from the dropbox API. But I couldn't see the additional description until I ran the curl command generated by the script and it the reponse (the output) There was the following: Error in call to API function "files/download": Your app is not permitted to access this endpoint because it does not have the required scope 'files.content.read'. The owner of the app can enable the scope for the app using the Permissions tab on the App Console.

So I went again to set some more permissions because I was missing permissions. One thing I noticed (one my linux machine): once you change the permission you have to delete your dropbox-uploader configuration file and do the process again for the permission changes to take effect. It is now working as expected.

I hope this helps you @skorzennik

skorzennik commented 3 months ago

I have checked files.metadata.read and files.content.read, yet 'list' fails. After removing ~/.dropbox_uploader (renaming it) I'm unable to get anything done. We're switching to rclone, that is setup w/out any fuss and works, Sorry,