cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Convert V1 User to V2 User With V2 BasicAccount Details

Convert V1 User to V2 User With V2 BasicAccount Details

DavidPaynter
Explorer | Level 3
Go to solution

We have a set of applications that have been using the Dropbox V1 API and the users' Display Name, Token Value and Secret Value have been stored in the DB. We are now wanting to seamless convert the users' accounts across to the V2 API, without the users having to reauthenticate their accounts via the Dropbox website.

 

We have achieved converting the V1 Token and Secret to a V2 Token using the Api.Auth.TokenFromOauth1Async method. So we now have the V2 Token value only returned by this method.

 

How do we retrieve all the users' other details (BasicAccount) from just having the V2 Token?

 

It would appear that the GetAccountAsync method would return the desired user data, such as: Uid, Display Name, etc. However, the input parameter for this call is the Uid, but we only have the V2 AccessToken available.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

FullAccount is a subclass of Account, which does include Email and Name.

 

var account = await this.client.Users.GetCurrentAccountAsync();
Console.WriteLine(account.Name.DisplayName);
Console.WriteLine(account.Email);

 

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution
You can instead use GetCurrentAccountAsync to get the linked user's account information (i.e., for the user identified by the access token you use for the call), without specifying a user ID:

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Users_Routes_UsersUserRoutes_GetCurr...

So, call that with each access token you need to associate with user information.

DavidPaynter
Explorer | Level 3
Go to solution

The GetCurrentAccountAsync method returns FullAccount class - which does not include the User's personal information such as Name and Email, so that method doesn't work.

 

What method do I call to return the Account Class and/or the Name Class?

Greg-DB
Dropbox Staff
Go to solution

FullAccount is a subclass of Account, which does include Email and Name.

 

var account = await this.client.Users.GetCurrentAccountAsync();
Console.WriteLine(account.Name.DisplayName);
Console.WriteLine(account.Email);

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    DavidPaynter Explorer | Level 3
What do Dropbox user levels mean?