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
PPT320
4 years agoNew member | Level 2
Missing scope from request
Hi,
I'm looking for some help setting up an Android app with the api.
I am looking to list all files in a dropbox folder, select one to download and then read it into my app to process the data. The initial download is very similar to the Android SDK example but even that isn't working properly as it, like my app, creates an empty local file and the DownloadFileTask.java shows an error. I've traced this to
2021-05-21 10:01:02.336 10188-10188/com.example.********. E/com.example.********.FilesActivity: Failed to download file.
d.a.a.s: {"error_summary": "missing_scope/.", "error": {".tag": "missing_scope", "required_scope": "files.content.read"}}
In the developer app centre I definitely have file.content.read clicked and I have removed all data from my app and uninstalled. On reinstallation it asks me to login to dropbox which I assume then re-authenticates the app, which should have the scope set. Neither the SDK example nor my app is actually creating the file
I have the app-key set in R.string.app_key and also in the manifest in the AuthActivity section, although I don't have an activity in my app called AuthActivity, so not sure why it should be there.
Please help as this is holding me up.
You can actually do either.
If you want it to default to whatever is set for the app on the App Console at that point in time, you should pass in null.
If you want to be specifically defined by the code, even if additional scopes are added to the App Console, you should pass the specific desired scope list. (Note that you can't request scopes that aren't enabled for the app though.)
- Greg-DBDropbox Staff
The '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.
That being the case, to make any API calls that require that scope, you'll need to get a new access token with that scope. It sounds like you've already done so though, so I also recommend checking the code you're running to process the authorization flow itself. While the scopes you enable on the App Console are used as the default scopes for the app, the app can also optionally specify a smaller set of scopes at authorization time. For example in this line of code in the sample app, it only requests "account_info.read" and "files.content.write". You would need to modify that if you want to request "files.content.read" as well.
- PPT320New member | Level 2
Thanks for your reply Greg,
So do you mean remove the arrays completely to force use of defaults, like
DropboxActivity.startOAuth2Authentication(UserActivity.this, getString(R.string.app_key), null);
or actually add the files.content.read like
DropboxActivity.startOAuth2Authentication(UserActivity.this, getString(R.string.app_key), Arrays.asList("account_info.read", "files.content.read", "files.content.write"));
I would prefer if it called all be controlled from the app on dropbox/developer
- Greg-DBDropbox Staff
You can actually do either.
If you want it to default to whatever is set for the app on the App Console at that point in time, you should pass in null.
If you want to be specifically defined by the code, even if additional scopes are added to the App Console, you should pass the specific desired scope list. (Note that you can't request scopes that aren't enabled for the app though.)
About Discuss Dropbox Developer & API
Make connections with other developers
797 PostsLatest Activity: 2 days 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!