Learn how to make the most out of the Dropbox Community here 💙. 

Forum Discussion

dhoerl1's avatar
dhoerl1
New member | Level 2
5 years ago
Solved

Create an App, get a Auth Token, try to use CURL to upload file, get a 400

Obviously I'm missing something.

 

I have an account, and created an App. I also created an OAUTH Token. I then found this curl script, and want to uplaod a file:

 

curl -X POST https://content.dropboxapi.com/2/files/upload \

    --header "Authorization: Bearer <token>" \

    --header "Dropbox-API-Arg: {\"path\": \"/1.jpg\"}" \

    --header "Content-Type: application/octet-stream" \

    --data-binary @./Cushion.jpg

 

I get this return: 

Error in call to API function "files/upload": Your app is not authorized to use this endpoint.

 

So how to I get it authorized?

  • User error - hadn't hit the SUBMIT button when I set the permissions. I just didn't see it buried at the bottom of the page, in a floating panel.

  • dhoerl1's avatar
    dhoerl1
    New member | Level 2

    User error - hadn't hit the SUBMIT button when I set the permissions. I just didn't see it buried at the bottom of the page, in a floating panel.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      Thanks for following up. I'm glad to hear you already sorted this out. 

       

      For reference for anyone else who comes across this, the "Your app is not authorized to use this endpoint" error indicates that the app for the access token you're using to make the call does not have the necessary scope needed for calling that particular endpoint.

      You can find information about what scope is needed for each endpoint in the documentation. For example, for /2/files/upload, you need the 'files.content.write' scope.

      If your app doesn't already have the scope enabled, you can add it via the "Permissions" tab on the app's info page on the App Console. Then you can get a new access token with that scope added and use that new access token to make the API call.