Learn how to make the most out of the Dropbox Community here 💙.
Forum Discussion
env
3 years agoExplorer | Level 3
retrieve access code automatically - javascript
Hey! I'm trying to connect to Dropbox using Oauth and I cant figure out a way to retrieve the access code automatically. I want that after I press connect in my site and the user press continue and...
env
3 years agoExplorer | Level 3
Finally I would like to connect our product to the Dropbox Business app, And our clients will only need to put their user name and password for the Dropbox website, can I make it fully automated? it can be either in Java/Javascript. can you provide examples in both languages (Java - the flow start from getting the access code all the way to refresh the token once it is in our system, Javasript - start from getting the access code all the way to the callback function).
Thank you in advance!
Greg-DB
Dropbox Staff
3 years agoenv As Здравко noted, this error message is referring to specifying what account on the Business team to operate on behalf of. For reference, when using any "team scopes", the resulting access token is connected to an entire Dropbox Business team, not an individual account. So, when using a team-scoped access token to access user-specific endpoints, such as /2/users/get_current_account, you will need to specify which member of the team you want to operate on behalf of.
To do this, you'd need to specify the 'Dropbox-API-Select-User' header (or 'Dropbox-API-Select-Admin' as needed/desired). The value should be the team_member_id
for whichever member you wish to act on behalf of. (For example, you can find team member IDs by calling /2/team/members/get_info_v2 or /2/team/members/list_v2[/continue], or corresponding native method in an SDK.)
(Alternatively, if you just want to connect to a particular account, you can disable any team scopes and get a new access token/refresh token without them. The access token without the team scopes will be specific to the particular account, Business or not, and so will not require the additional header. You can find more information on scopes in the OAuth Guide.)
Dropbox does also offer an official Java SDK. You can find the documentation and examples here. Both of these SDKs support offline access with refresh tokens for unattended long-term access.
To set the the 'Dropbox-API-Select-User' header in the JavaScript SDK, you would use the 'selectUser' option on the Dropbox object. To se it with the Java SDK, you would use DbxTeamClientV2.asMember.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,965 PostsLatest Activity: 4 hours ago
If 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!