Start 2025 on time and up to date! Seamlessly integrate your calendars into Dropbox with these simple steps! 📆

Forum Discussion

Probe9's avatar
Probe9
Explorer | Level 3
4 years ago
Solved

Dropbox .NET SDK - DropboxClient usage

Hi all,

 

I'm working with Dropbox .Net v2 api from nuget (6.22.0) in a Windows Desktop application (.net core 3.1).

 

I successfully integrate the OAuth2 flow as recommends in documentation:

A client-side Desktop app or mobile app that requires background access: Use the OAuth code flow with PKCE, with refresh tokens.

 

With given information I'm able to create the DropboxClient class:

 

 

Documentations defines that the DropboxClient automatically refresh the access_token, but that happens on any type of API calls?

As example, when I perform a client.Files.DownloadAsync, before actually do it, is the access_token refreshed if expired?

 

What is the recommends usage of the client; create, perform a request then dispose, or; should it be a single instance and stay alive for the entire app life time?

 

Thanks in advance.
 
Ciao
  • The client will automatically perform the refresh process for you whenever needed, on any such call, so you do not need to dispose of your existing client.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The client will automatically perform the refresh process for you whenever needed, on any such call, so you do not need to dispose of your existing client.