cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Check out the Dropbox cheat sheet for getting started in 2021 here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get User ID from Chooser API

Get User ID from Chooser API

New member | Level 2

In my app, I am using the OAuth properly and am able to interact with a user's file (read, write etc). My flow is currently:

1. Get access_token by having the user allow the app access to their account and calling this endpoint

https://api.dropbox.com/oauth2/token

2. Have user select files from the Chooser 

3. Use the access_token and file information to perform the necessary operations

However, now there is a requirement to support multiple dropbox accounts per user. I can once again use the token endpoint to get the access_token for each account, but I am lost on how to get the account ID when the user interacts with the chooser so I can relate each file with the proper access_token.  Is there an endpoint or option on the chooser to get the account ID on what the logged in account is when the user opens the Chooser? 

1 Accepted Solution

Accepted Solutions

Re: Get User ID from Chooser API

Dropboxer

No, I'm afraid there isn't anything quite like that either. (The Chooser wasn't originally designed to be used together with the API, so there isn't much interoperability.)

There are a few ways you can try, though they're not ideal and won't be 100% reliable for this:

  1. Once you have the file ID, try calling /2/files/get_metadata with the file ID using each of the access tokens you have. If the account has access to the file, you'll get the metadata back. If not, you'll get an error.
  2. Once you have the shared link, try calling /2/sharing/get_shared_link_metadata with the shared link using each of the access tokens you have. If the link owner is a team member of the same team as the connected account for that access token, `team_member_info` will be set.

View solution in original post

4 Replies 4

Re: Get User ID from Chooser API

Dropboxer

No, unfortunately there isn't a way to get the account ID from the Chooser like this, but I'll pass this along as a feature request. I'm not currently aware of any plans to implement this though.

Re: Get User ID from Chooser API

New member | Level 2

Ah shucks :(

Per chance, is there any way to get the user info from the file info? For example, maybe get the account ID from the file ID or file link from another API endpoint?

Re: Get User ID from Chooser API

Dropboxer

No, I'm afraid there isn't anything quite like that either. (The Chooser wasn't originally designed to be used together with the API, so there isn't much interoperability.)

There are a few ways you can try, though they're not ideal and won't be 100% reliable for this:

  1. Once you have the file ID, try calling /2/files/get_metadata with the file ID using each of the access tokens you have. If the account has access to the file, you'll get the metadata back. If not, you'll get an error.
  2. Once you have the shared link, try calling /2/sharing/get_shared_link_metadata with the shared link using each of the access tokens you have. If the link owner is a team member of the same team as the connected account for that access token, `team_member_info` will be set.

View solution in original post

Re: Get User ID from Chooser API

New member | Level 2

Gotcha, I was thinking of doing something along those lines. Thanks Greg

Polls
Are you starting new work habits this year?

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?