I just got started with using the DropBox API for Python - i want to use it to store files that my Discord Bot previously downloaded, but even following the official tutorial 1:1 i cant get it to just read and write files.
I registered the app and generated an access token, and it always tells me dropbox.exceptions.AuthError: AuthError('09d729accff6a6d8fa601154df010b0b', AuthError('missing_scope', TokenScopeError(required_scope='files.metadata.read')))
when i try to read dbx.files_list_folder('').entries
for example. I checked the permissions and saw that apparently, the access token has no permissions yet, so i checked the right permissions. However, i cannot generate a new access token with the new permissions now, because it says `You must be a team administrator to perform this operation.´
I think i am missunderstanding something here, but i dont know why this basic example that i got from the offical site wont work.
If you'd like to quickly test out the Dropbox APIs using your own Dropbox account before implementing OAuth, you can generate an access token from your newly created app in My apps by pressing the button that says "Generate" in the OAuth 2 section of your app settings page.
Go to the Dropbox App Console and log in (you need a Dropbox account to do this). Select Create App. After the app is created, you will be taken to the App's settings page for the app. Scroll to the OAuth 2 section, find the Generated access token section and click on Generate.
The Dropbox API allows developers to work with files in Dropbox, including advanced functionality like full-text search, thumbnails, and sharing. The Dropbox API explorer is the easiest way to get started making API calls.
Regarding the 'missing_scope' error: You're correct, the app and access token need the particular scope required by the route in order to access the route. Note that just enabling a particular scope for an app, via the App Console, does not retroactively add authorization for that scope to existing access tokens though. So, you'd need to process the authorization flow (either the OAuth flow or using the "Generate" button) again to authorize an access token with any newly enabled scopes, as you attempted.
Regarding the "You must be a team administrator to perform this operation" error: That indicates that you selected one or more "team" scopes, which can only be authorized by a team admin, but you're not an admin on a Business team. In that case, you'd need to remove any team scopes to connect the app.
Also, note that the 'files.permanent_delete' scope automatically requires the 'team_data.member' scope, so you can't use 'files.permanent_delete' from a non-team account, and so enabling the the 'files.permanent_delete' scope will also cause that. (Edit: Fixed: There's also a current issue that can prevent you from deselecting the 'team_data.member' scope if your app uses the "app folder" access type. We're working on fixing that, but you may need to re-create the app if you're in that state and want to use it before the fix is out.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With