We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

realtebo's avatar
realtebo
Explorer | Level 3
2 years ago

How to enable an app to use "Generated access token" to list MY and only mine FOLDER content list?

I createad a new app, it's a scoped/ full dropbox app.   I generated a token.   I added each every read scope to my app.   When i call files/list_folder I got a cryptic error about a miss...
  • Greg-DB's avatar
    2 years ago

    A 'missing_scope' error indicates that while the app is permitted to use that scope, the particular access token you're using to make the API call does not have that scope granted. Also, be aware that just adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens (or refresh tokens).

    So, if you created the access token before enabling the additional scopes, to make any API calls that require a newly enabled scope, you'll need to get a new access token with that scope authorized. Refer to the OAuth Guide and authorization documentation for more information.

     

    For reference, you can see which scope is required for any particular endpoint in the API documentation, such as here for /2/files/list_folder, which indicates it requires 'files.metadata.read'. Also, when you get an error like this, be sure to print out the full response body as it may contain a more specific error, such as the missing but required scope in this instance. For example, here's a call I just tried to /2/files/list_folder with an insufficiently scoped access token and the response sent back:

    curl -X POST https://api.dropboxapi.com/2/files/list_folder \
        --header "Authorization: Bearer <ACCESS_TOKEN>" \
        --header "Content-Type: application/json" \
        --data "{\"path\":\"\"}"
    
    # {
    #   "error_summary": "missing_scope/...",
    #   "error": {
    #     ".tag": "missing_scope",
    #     "required_scope": "files.metadata.read"
    #   }
    # }