Auth0.Android icon indicating copy to clipboard operation
Auth0.Android copied to clipboard

Add ability to configure callTimeoutMillis, readTimeoutMillis and writeTimeoutMillis in OkHttpClient used by DefaultClient

Open Dmitry-Komarovsky opened this issue 1 year ago • 2 comments

Checklist

  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

When using CredentialsManager.getCredentials() method there is no direct way to set a custom value for callTimeoutMillis, readTimeoutMillis and writeTimeoutMillis in OkHttpClient used by DefaultClient class. DefaultClient class doesn't set any value to callTimeoutMillis therefore it is 0 by default which means unlimited timeout and this leads to the need to limit this timeout on the client side, for example limit the execution time of CredentialsManager.getCredentials() with external means such as CountDownLatch and wrap this code in a try-catch block.

Describe the ideal solution

Add new parameters to the constructor of Auth0 class to set custom values of callTimeoutMillis, readTimeoutMillis and writeTimeoutMillis.

Alternatives and current workarounds

Limit the execution time of CredentialsManager.getCredentials() with external means such as CountDownLatch and wrap this code in a try-catch block.

Additional context

No response

Dmitry-Komarovsky avatar Dec 12 '24 17:12 Dmitry-Komarovsky

Hi @Dmitry-Komarovsky , Thank you for bringing this up. Will discuss this with the team to take this in the coming releases

pmathew92 avatar Dec 13 '24 07:12 pmathew92

We have planned to add support to this feature as part of the next major version release of the SDK.

pmathew92 avatar Jul 11 '25 06:07 pmathew92