cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

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

how to get access token without authorization code in c#

how to get access token without authorization code in c#

amitgaur
New member | Level 2

Hi,

 

Is there any way to generate access token without getting authorization code using only client id and secret key in asp .net core c#? I need only access token to do operations.

 

or how to get access token with no expiration

 

Thanks in advance

Regards,

Amit Gaur

4 Replies 4

Greg-DB
Dropbox Staff

It is not possible to automatically/programmatically get an access token using just the app key/secret. The app authorization flow needs to be done manually by the user at least once.

 

Dropbox is no longer offering the option for creating new long-lived access tokens. Dropbox is now issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here.

Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.

 

If you're using .NET, we recommend using the official Dropbox API v2 .NET SDK. When you use the official Dropbox API v2 .NET SDK, you do not need to implement all of the code for the OAuth flow yourself. The SDK will do most of the work for you. You can find examples of using this here.

harshatupwork
Explorer | Level 3

Dear Team,
Thank you for your reply. On my system, if dropbox desktop app is already logged in, is there any way to create document link using code without login or can I get new access token using any api without asking credential from user.

Regards,
Harsh

Здравко
Legendary | Level 20

@harshatupwork wrote:

... On my system, if dropbox desktop app is already logged in, is there any way to create document link using code without login ...


Hi @harshatupwork,

Such a feature is supported on Linux only by now. So, if your system is Linux, then Yes, otherwise - No.

 


@harshatupwork wrote:

... can I get new access token using any api without asking credential from user.

...


No, there is no way to get either access or refresh token without user be asked. It's partially available on mobile devices only. There the user only need to agree without need to enter again id/email and password, when already logged in to the Dropbox application.

Greg-DB
Dropbox Staff

@harshatupwork As Здравко mentioned, there are some command line options for communicating directly with the Dropbox desktop client on Linux only. You can find the information for that here.

 

Otherwise, you'll need to use the API and authorization flow as documented in the resources in my previous message in this thread.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    harshatupwork Explorer | Level 3
What do Dropbox user levels mean?