You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Garnik G.'s avatar
Garnik G.
Explorer | Level 4
10 years ago

How to get files by DropBoxRest API in C#

Hi

My goal is to get files by DropBoxRest API in C#
Here is my code

var options = new Options
    {
        ClientId = "", //App key
        ClientSecret = "", //App secret
        RedirectUri = "https://www.dropbox.com/1/oauth2/authorize"
    };

// Initialize a new Client (without an AccessToken)
var client = new Client(options);

// Get the OAuth Request Url
var authRequestUrl = await client.Core.OAuth2.AuthorizeAsync(access_token which generated in my account);

// TODO: Navigate to authRequestUrl using the browser, and retrieve the Authorization Code from the response
var authCode = ""; Which code have to be here ???

// Exchange the Authorization Code with Access/Refresh tokens
var token = await client.Core.OAuth2.TokenAsync(authCode); in this line occured the following error
  //An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll      

// Get account info
var accountInfo = await client.Core.Accounts.AccountInfoAsync();

Please give me an advice