cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to make sure we keep you updated on the ideas that other users have shared here on the Community? Us too! Check them out over here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Reply and help

refresh token using C# and all

refresh token using C# and all

Anggadika
Explorer | Level 3

Hi Dropbox,

Can you provide an example of making GetToken using .Net Developer C# and upload and download it at the same time. for Dropbox V2 APIs.

 

Thanks

8 Replies 8

Re: refresh token using C# and all

Greg-DB
Dropboxer

There are examples included with the Dropbox .NET SDK that show how to handle various pieces of functionality in different scenarios, such as the authorization flow as well as uploading and download files. You can find all of the example code here:

 

https://github.com/dropbox/dropbox-sdk-dotnet/tree/main/dropbox-sdk-dotnet/Examples

Re: refresh token using C# and all

Anggadika
Explorer | Level 3

Maybe you can give an example using video or YouTube to make it easier to implement

Re: refresh token using C# and all

Anggadika
Explorer | Level 3

 

I have tried, but access is denied.

Anggadika_0-1674719818140.png

this is source code when error.

Anggadika_1-1674719920464.png

Please Help Why Access is Denied

 

Re: refresh token using C# and all

Greg-DB
Dropboxer

Dropbox doesn't offer video tutorials for the Dropbox API, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

 

Regarding the issue you're currently seeing, the http.Start() line starts a local HTTP listener to receive the result of the authorization flow automatically. The "Access is denied" error doesn't seem to be coming from Dropbox itself, but rather from your system indicating you aren't able to start the listener. Please refer to your platform/operating system's documentation for information on how to configure your permissions to allow your account to start a listener like that. Unfortunately as that's not made by Dropbox, I can't offer support for that itself.

 

Alternatively, you can omit the redirect URI and not use a listener to receive the result. The redirect URI is actually optional, in which case you would be presented with the authorization code to copy/paste back into the app manually.

Re: refresh token using C# and all

Здравко
Super Collaborator | Level 20

@Anggadika wrote:

 

I have tried, but access is denied.

Anggadika_0-1674719818140.png

...


Hi @Anggadika,

Did you read the example' comment?


from the source:

// This loopback host is for demo purpose. If this port is not

// available on your machine you need to update this URL with an unused port.

private const string LoopbackHost = "http://127.0.0.1:52475/";


Have you checked some other port? One more restriction, you should consider, is all ports below 1000 are considered by some environments as special and are not provided to regular programs. Did you select such a port explicitly or implicitly (take in mind that HTTP matches by default to port 80 and HTTPS - to 443)? Such ports can be forbidden even when the OS doesn't set such restrictions (it's environment restriction for better portability). Review your settings.

Good luck.

Re: refresh token using C# and all

Anggadika
Explorer | Level 3

I have tried several ports including http with port 80 and https with port 443, but the result is still "access denied".

why is "access denied" please?
what settings should be changed?

Re: refresh token using C# and all

Anggadika
Explorer | Level 3

for my port it's done.
now the problem is when running the script (which I marked) it doesn't work anymore.

 

now i have problem while running this script

Anggadika_1-1674814391448.png

this result "An error occurred while sending the request."

Anggadika_0-1674814284529.png

Please Help @Здравко 

Re: refresh token using C# and all

Здравко
Super Collaborator | Level 20

Hi again @Anggadika,

Seems your system has some problems.

 


@Anggadika wrote:

...

this result "An error occurred while sending the request."

...


Such an error occurs when connection to the target server cannot be established. The reasons can be different, but typical case is DNS caching (and mismatch). To check in details, what's going on, better catch the actual exception (HttpRequestException) and dump all the information available there (including inners). After that fix it according your findings.

 

ADD: Since Dropbox API servers use TLSv1.2 only, another typical reason is mismatch in supported encryption setting. Make sure you have enabled TLSv1.2!

Who's talking

Top contributors to this post

  • User avatar
    Здравко Super Collaborator | Level 20
  • User avatar
    Anggadika Explorer | Level 3
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?