We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

DavidPaynter's avatar
DavidPaynter
Explorer | Level 3
8 years ago

Convert V1 User to V2 User With V2 BasicAccount Details

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.

  • Greg-DB's avatar
    Greg-DB
    8 years ago

    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);

     

    • DavidPaynter's avatar
      DavidPaynter
      Explorer | Level 3

      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's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        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);

         

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 4 hours ago
325 Following

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!