Forum Discussion

CCLFREPORTING's avatar
CCLFREPORTING
Explorer | Level 3
3 years ago

C# Get Access Token without browser interaction

I am working on .net console application to download dropbox documents

i was able to do that with the generated access token from the application configuration but it gets  expires

 

i am following sample solution from github for OAuth dropbox-sdk-dotnet/Program.cs at b5dff871d353c46dcdf61f0319a10be4ed0b8c0c · dropbox/dropbox-sdk-dotnet (github.com)

after entering ClientID and Client Secret  and clicking the approve on browser i was able to get access token

 

 

is there a way to get access token from C# without browser interaction  as i need to schedule the file download .net console application without user interaction

 

 

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

    It is not possible to fully automate this process. This needs to be done manually by the user at least once. If your app needs to maintain long-term access without the user manually re-authorizing it repeatedly, the app should request "offline" access so that it gets a refresh token. The refresh token doesn't expire and can be stored and used repeatedly to get new short-lived access tokens whenever needed, without the user manually reauthorizing the app.

     

    For the official Dropbox API v2 .NET SDK, you can find an example of using the new authorization functionality, including getting and using a refresh token, in the OauthBasic example (non-PKCE, meant for server-side apps) as well as in the OAuthPKCE example (PKCE, meant for client-side apps).

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,945 PostsLatest Activity: 5 hours ago
351 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!