We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Simone11
6 years agoExplorer | Level 4
Dropbox for Business API Access token login process.
Hi There. I have an iOS apllication written in Objective-C. I have successfully integrated Dropbox API in my app and I can upload and download data from dropox even using the Access Token for it. ...
- 6 years ago
If you have a Dropbox Business API access token for an app with the "team member file access" permission and want to programmatically access a specific member's account using the Dropbox Objective-C SDK, you should use the DBTeamClient userClientWithMemberId: method. That will give you a DBUserClient you can use to access the user methods, such as listFolder. (It sets the "Dropbox-API-Select-User" header mentioned in the error message you shared.)
That would look like this:
DBTeamClient *teamClient = [[DBTeamClient alloc] initWithAccessToken:ACCESS_TOKEN]; DBUserClient *userClient = [teamClient userClientWithMemberId:memberID]; [[userClient.filesRoutes listFolder:path] setResponseBlock...
The member ID would be the team member ID (which starts with "dbmid:"). You can get those from membersList/membersListContinue, for instance.
Also, note that client-side applications, such as on iOS, can't keep secrets, such as access tokens, from a malicious user. For that reason, we don't recommend sharing/hard-coding access tokens in client-side applications. For example, in your described scenario, one team member could potentially extract the access token and use it to access another member's account.
Greg-DB
6 years agoDropbox Staff
If you have a Dropbox Business API access token for an app with the "team member file access" permission and want to programmatically access a specific member's account using the Dropbox Objective-C SDK, you should use the DBTeamClient userClientWithMemberId: method. That will give you a DBUserClient you can use to access the user methods, such as listFolder. (It sets the "Dropbox-API-Select-User" header mentioned in the error message you shared.)
That would look like this:
DBTeamClient *teamClient = [[DBTeamClient alloc] initWithAccessToken:ACCESS_TOKEN]; DBUserClient *userClient = [teamClient userClientWithMemberId:memberID]; [[userClient.filesRoutes listFolder:path] setResponseBlock...
The member ID would be the team member ID (which starts with "dbmid:"). You can get those from membersList/membersListContinue, for instance.
Also, note that client-side applications, such as on iOS, can't keep secrets, such as access tokens, from a malicious user. For that reason, we don't recommend sharing/hard-coding access tokens in client-side applications. For example, in your described scenario, one team member could potentially extract the access token and use it to access another member's account.
- Sim_one6 years agoExplorer | Level 4
Thanks Greg-DB for your inputs.
I am not clear on getting memeberID though( how to get the member id to be precise?).
Also, 1 perticular memberID give access to account of that team member correct?
But my requirement is we distribute our iOS app as enterprise within the team of our organisation. Those people are the Dropbox Team members. So, once we give them the app they should be able to login to thier account without Auth using this dropbox for Business Access token. In that case they should know thier memberID's right to access it. Is there any other way members get their memberID other than how you specified above so that they can manually enter the memberID to access their account using access token? because I believe it is not feasible to give users option in the app to select memberID.
I hope you understand my case.
Any suggestion to go ahead for my this scenario??
- Greg-DB6 years agoDropbox Staff
You can list all of the members of a team using membersList/membersListContinue. The result will contain each member's team member ID. You can also look up a specific member by email address or external ID using membersGetInfo.
A team member ID itself only identifies a particular member's account on a team. It doesn't itself give access to that member's account. You would need an access token to access an account. An access token for a "Dropbox Business API" app, such as you are using based on the output you shared previously, is for the entire Business team.
Using a Dropbox Business API access token for an app with the "team member file access" permission, you can specify the particular team member account you want to access in particular by specifying the team member ID as in the code in my previous comment. (This is the "member file access" feature documented here.)
End-users generally don't know, and don't have a way in the Dropbox UI, to access their own team member ID. This is something the Business API app should do for them (for instance, using the methods I described at the beginning of this message).
Anyway, since a Dropbox Business API access token enables access to the entire team, we don't recommend distributing it to every team member in client-side applications. It is generally meant to be used server-side, where it can be protected.
- Simone116 years agoExplorer | Level 4
Hi Greg-DB ,
So that means using Access token for business admins account and memberID I should be able to access that members folders/directory structure similar to how I do using personal normal access token with same methods(listfolders) correct? Also, I should be able to download and update data/files to these members folders I Specify in members account right?
Also one out of the context question. Is there a way Team Admin can hide/Make other team memebers not see who all are there in their Team? I just dont want other team member to see who are there in their team when they login to their DB account on web.
- Bharath_Nadig6 years agoExplorer | Level 4
Similar option is there for JAVA SDK ?
- Bharath_Nadig6 years agoExplorer | Level 4
Is there a similar option for java sdk?
- Greg-DB6 years agoDropbox Staff
Bharath_Nadig Yes, the Dropbox Java SDK also has support for the "member file access" feature. You can use the DbxTeamClientV2.asMember or DbxTeamClientV2.asAdmin methods to get a DbxClientV2 with the 'Dropbox-API-Select-User' or 'Dropbox-API-Select-Admin' header set, respectively.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months 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!