openid / AppAuth-Android

Android client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
https://openid.github.io/AppAuth-Android
Apache License 2.0
2.79k stars 877 forks source link

Timeout twice as long as configured for AuthorizationServiceConfiguration.fetchFromUrl(Uri openIdConnectDiscoveryUri, RetrieveConfigurationCallback callback)? #840

Open alixwar opened 2 years ago

alixwar commented 2 years ago

Configuration

Description

I am trying to retrieve an OpenID Connect Discovery document by calling AuthorizationServiceConfiguration.fetchFromUrl(openIdConnectDiscoveryUri, callback) towards and endpoint (where I expect it to fail... This is to test error handling) and I get this error after ~30s (notice the timestamps):

2022-06-08 14:22:37.909 27365-27365/com.mycompany.myapp  I/AuthenticationPersModel: [I=1, T=M] signIn(context=[hidden])
...
2022-06-08 14:23:08.126 27365-28830/com.mycompany.myapp E/AppAuth: Network error when retrieving discovery document
    java.net.SocketTimeoutException: failed to connect to mykeycloakserver.com/x.y.z.q (port 8083) from /192.168.201.29 (port 50032) after 15000ms

For reference, the default timeout config settings in net.openid.appauth.connectivity.DefaultConnectionBuilder:

private static final int CONNECTION_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(15);
private static final int READ_TIMEOUT_MS = (int) TimeUnit.SECONDS.toMillis(10);

I was expecting to get the timeout error after 15s (default connection timeout). Why do I instead get the error after 2x15s?

deepakkanyan commented 3 months ago

Same here.