cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

slow response time when calling Dropbox.Api (6.37.0) with expired access token

slow response time when calling Dropbox.Api (6.37.0) with expired access token

sbrownnw
Explorer | Level 4
Go to solution

Hello.  I am calling an established Dropbox account setup for an application with API access with what was once a valid access token that has expired.  It takes about 15 seconds or more to obtain the AuthException: expired_access_token result.  Why is this?  The response should be in milliseconds, not 15 seconds or more.

 

Code is listed below (.Net Core 6.0 console app) with debug session showing the stopwatch running for over 20 seconds before exception was encountered:

sbrownnw_0-1683830328239.png

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Thanks for the report. It looks like the .NET SDK is unnecessarily retrying (repeatedly, with a backoff) on 'expired_access_token' failures. I'll ask the team to update it to skip the automatic retries on that kind of failure.

 

To work around this, you can make a DropboxClientConfig with maxRetriesOnError set to 0, and pass that to DropboxClient. That would prevent the automatic retries and eliminate the extra latency in this case. It would also prevent the automatic retries in cases where they may be useful though, so if you want to lower that extra latency without completely disabling automatic retries, you can set it to a number between 0 and 4 (since 4 is the default).

View solution in original post

3 Replies 3

sbrownnw
Explorer | Level 4
Go to solution

Running the same code with an invalid access token (empty string returns in less than 3 seconds on average):

 

sbrownnw_1-1683830741685.png

 

Greg-DB
Dropbox Staff
Go to solution

Thanks for the report. It looks like the .NET SDK is unnecessarily retrying (repeatedly, with a backoff) on 'expired_access_token' failures. I'll ask the team to update it to skip the automatic retries on that kind of failure.

 

To work around this, you can make a DropboxClientConfig with maxRetriesOnError set to 0, and pass that to DropboxClient. That would prevent the automatic retries and eliminate the extra latency in this case. It would also prevent the automatic retries in cases where they may be useful though, so if you want to lower that extra latency without completely disabling automatic retries, you can set it to a number between 0 and 4 (since 4 is the default).

sbrownnw
Explorer | Level 4
Go to solution

Thanks for the quick reply.  Yes, your solution / workaround did make the response time better with using MaxRetriesOnError set to zero.  I am still seeing response times of 6 to 12 seconds with this change.  Seems like it should be 50% of the response times I am seeing when passing an expired token.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    sbrownnw Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?