We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

gregarican's avatar
gregarican
Explorer | Level 4
3 years ago

C# Dropbox.API File Upload Errors

I'm using the most recent NuGet package for my VS 2019 project. My app has worked consistently for several years now. But recently I have logged errors when invoking the client.Files.UploadAsync() method. The underlying exception appears as The request was aborted: Could not create SSL/TLS secure channel. I have debugged my code and can see an access token is being provided so the API call is correctly authenticated. 

 

These errors are spotty, and don't happen consistently. At first I thought there was an issue with my WebView2 control I use in order to ensure that OAuth2 is properly functioning. But that has been eliminated, as I can verify that the access token is there. Now doing some additional troubleshooting and code changes I am getting back an error stating the access token has expired.

 

Did something recently change in terms of the API endpoint and its behavior?   

  • gregarican's avatar
    gregarican
    Explorer | Level 4

    I think I might have stumbled upon what's going on. First off, I needed to ensure I am enforcing TLS 1.2 throughout my project. Previously it was just defined within the initial OAuth2 form's method. Secondly, I have read on the community posts that the access tokens now have shorter expiration times compared to previously. Strange that just now in 2022 I'm running into that mechanism. Most of the community posts were from a year or more ago where developers ran into this happening.

     

    Between both elements I hope to have things patched up for my project. Time and testing will certainly tell. 😀

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

    Yes, that "Could not create SSL/TLS secure channel" error indicates this is due to a problem establishing the secure connection between your client and the Dropbox API servers. Specifically, Dropbox recently retired support for TLS 1.0 and 1.1. The Dropbox API servers now only support connections using TLS 1.2. You'll need to update your app/network client/environment to use TLS 1.2 in order to continue making Dropbox API calls.

     

    For your client/environment, please refer to the relevant documentation for information on enabling the relevant platform support. For example, Microsoft in particular appears to have some resources here which may be helpful:
     

     

    Additionally, technically unrelated to the TLS issue, Dropbox is in the process of switching to only 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.

    For reference, while the creation of new long-lived access tokens is now deprecated, we don't currently have a plan to disable existing long-lived access tokens. (If that changes, we will of course announce that ahead of time.) That being the case, you can continue using existing long-lived access token(s) without interruption, if you have any. Also, note though that after the change you won't be able to create new long-lived access tokens.

    While the change began on September 30th 2021, we're releasing it gradually, so you may not have seen your app(s) affected until now. Once it applies to your app, it would apply regardless of the "Access token expiration" setting for your app, and that setting may no longer be available for your app.

    • gregarican's avatar
      gregarican
      Explorer | Level 4

      Thanks for all of the info! Very insightful. Now since I am using the Dropbox.API NuGet package, could you point me to any examples of tokenization using the "new" mechanism that's being rolled out? 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 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!