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
Steve_Neo
5 years agoExplorer | Level 3
Can I use business app to access personal dropbox?
We provider an integration to our customers to upload files created by system. It works well for personal account. Basically, the process is the customer use Dropbox File Brower pick a folder, and ...
- 5 years ago
Yes, you can use an access token for a non-Business app to access Business accounts, including team folders.
First, for reference, the "Unexpected select user header" error is expected if you attempt to set the "Dropbox-API-Select-User" header when using an access token for a non-Business app, as that functionality is only needed for Business apps. You can remove that code and just use an access token for a non-Business app.
To access different parts of an account, you should use the "Dropbox-API-Path-Root" functionality as you've already begun to, as seen in your code. Note that you don't need to set this manually if you're using the Python SDK though. You can use the Dropbox.with_path_root method to set it instead.
For information on how to list and access different parts of Dropbox accounts, please review the Namespace Guide.
Greg-DB
Dropbox Staff
Can you elaborate on what you meant when you said "this doesn't work if my customer is using Business Dropbox Account"?
You should certainly be able to use the particular methods you listed with both Business or non-Business accounts. You don't need to register separate apps in that case. A single "Dropbox API" app can be used for those Dropbox API methods for any account type.
(If you do need to support both Business and non-Business accounts, and also need to use both Dropbox API methods, such as for file operations, and Dropbox Business API methods, such as for team operations like listing team members, then you would need to register two separate apps.)
Steve_Neo
5 years agoExplorer | Level 3
My App only need to these 3 methods: get metadata, create folder and upload file. If my user try to get_metadata of a team folder, I got this error by non-Business access token:
'Error in call to API function "files/get_metadata": Unexpected select user header. Your app does not have permission to use this feature'
Here is my code (Python):
dbx = Dropbox(access.access_token) dbx_user = dbx.users_get_current_account() team_member_id = dbx_user.team_member_id team_root = PathRoot.namespace_id(dbx_user.root_info.root_namespace_id) # set headers dbx = Dropbox(access.access_token, headers={"Dropbox-API-Select-User": team_member_id, 'Dropbox-API-Path-Root': stone_serializers.json_encode(PathRoot_validator, team_root)}) # here throw that permission issue: dbx.files_get_metadata(folder_id)
However, I use business token, use similar code - replaceusers_get_current_account() by
dbx_team.team_token_get_authenticated_admin()
Then my app can use files_get_metadata() without issues.
- Steve_Neo5 years agoExplorer | Level 3
So my question could be, can I use non-Business app token to upload file to team folder?
- Greg-DB5 years agoDropbox Staff
Yes, you can use an access token for a non-Business app to access Business accounts, including team folders.
First, for reference, the "Unexpected select user header" error is expected if you attempt to set the "Dropbox-API-Select-User" header when using an access token for a non-Business app, as that functionality is only needed for Business apps. You can remove that code and just use an access token for a non-Business app.
To access different parts of an account, you should use the "Dropbox-API-Path-Root" functionality as you've already begun to, as seen in your code. Note that you don't need to set this manually if you're using the Python SDK though. You can use the Dropbox.with_path_root method to set it instead.
For information on how to list and access different parts of Dropbox accounts, please review the Namespace Guide.
- steveneo5 years agoExplorer | Level 3
Yes, it works now. I think the major issue is I set the wrong permission on non-Business app. It should be "fullaccess".
The reason I didn't use Dropbox.with_path_root method. It is because it reset other HTTP headers, because I thought I should use both Dropbox-API-Select-User and root_path. Anyway, this is not important now. Thanks!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,912 PostsLatest Activity: 2 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!