You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
zulfi s.
2 years agoNew member | Level 2
Random 'missing_scope' errors
Hi,
I have been using the Dropbox iOS SDK for a number of years, and it's worked fine, and even transitioned to the v2 API a few years ago. Lately, some of my users seem to be getting this error repeatedly on their devices:
DropboxAuthError[{
ErrorContent = "missing_scope/";
RequestId = f52a524dff6c4d6a915da56dc520bea5;
StatusCode = 401;
StructuredAuthError = "<DBAUTHAuthError: 0x2811423e0>";
UserMessage = nil;
}];
This happens when the 'uploadUrl' API is called.
I've checked the 'permissions' in the App Console, and nothing there has changed. Specifically, I have enabled permission for "files.metadata.write" and "files.metadata.read". In my own testing, I am not able to reproduce the error at all. I have the users link to their account again by using DBClientsManager's 'authorizeFromControllerV2' API, which I believe should generate a new access token, and then they call the upload API again. but it doesn't seem to help.
Is there any way to figure why this error has started happening in the last few weeks? Has anything changed (or is there a bug) on the Dropbox SDK side? The Dropbox SDK version I'm using is 6.2.3.
Thanks.
- Greg-DBDropbox Staff
A 'missing_scope' should just indicate that 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.
I'm not aware of anything that may have changed on our side to break this recently. Did you recently migrate your app to scopes though? If you did so without enabling the relevant scope, that could have caused this.
In any case, to make any API calls that require that scope, you'll need to get a new access token with that scope. For the upload functionality in particular, you'd need the "files.content.write" scope. For the Dropbox Objective-C SDK, you would use the authorizeFromControllerV2 method to start the authorization process as you mentioned. You didn't mention the "files.content.write" scope though, so make sure that's both enabled for your app on the App Console, as well as requested during the authorizeFromControllerV2 flow. If you don't specify particular scopes when calling authorizeFromControllerV2, it will default to whatever scopes are currently enabled for the app on the App Console.
- zulfi s.New member | Level 2
Thanks for the response. For the past year, I have been using this to get the 'scopes', and then passing it into the V2 authorization API:
DBScopeRequest *scopeRequest = [[DBScopeRequest alloc] initWithScopeType:DBScopeTypeUser scopes:@[@"account_info.read", @"files.metadata.write", @"files.metadata.read"] includeGrantedScopes: YES];
So I apparently didn't add the "files.content.write" or "files.content.read" scopes here (though they are added on the App Console). But it's working fine since I made this change, and only in the last month did I receive reports from some users that the 'upload' isn't working anymore. Why would it have worked initially and not now?
- Greg-DBDropbox Staff
Migrating an app to scopes itself also doesn't change any existing access tokens, so users with pre-existing (non-scoped) authorizations would continue being able to upload files based on the previous broader authorization. In this scenario, only users that newly authorized the app with that insufficient list of scopes would start seeing that error.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 20 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!