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.
Advertisement
Answer
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.)