@@ -66,8 +66,8 @@ class FronteggAuthService(
6666 // Reconnecting state
6767 val isReconnecting = MutableLiveData <Boolean >()
6868
69- // Maximum wait time for network recovery (3 minutes)
70- private val maxWaitTimeMs = 3 * 60 * 1000L
69+ // No timeout for network recovery - wait indefinitely
70+ private val maxWaitTimeMs = Long . MAX_VALUE
7171
7272
7373 companion object {
@@ -278,14 +278,14 @@ class FronteggAuthService(
278278 }
279279
280280 if (! networkOk) {
281- Log .w(TAG , " Network quality check timeout after ${maxWaitTimeMs} ms , clearing credentials" )
281+ Log .w(TAG , " Network quality check timeout, clearing credentials" )
282282 clearCredentials()
283283 return false
284284 }
285285
286286 isReconnecting.postValue(false )
287287
288- val success = sendRefreshToken()
288+ val success = sendRefreshToken(isManualCall = true )
289289 if (success) {
290290 val processedCount = requestQueue.processAll()
291291 Log .d(TAG , " Processed $processedCount queued requests" )
@@ -369,10 +369,8 @@ class FronteggAuthService(
369369
370370 override fun refreshTokenIfNeeded (): Boolean {
371371 return synchronized(refreshMutex) {
372- // Check if auto refresh is disabled
373- if (disableAutoRefresh) {
374- return false
375- }
372+ // Manual refresh token calls should always work, regardless of disableAutoRefresh
373+ // disableAutoRefresh only blocks automatic refresh operations
376374
377375 // Check network quality before attempting refresh token
378376 if (! isNetworkGoodSync()) {
@@ -874,8 +872,9 @@ class FronteggAuthService(
874872 * @throws Exception if an error occurs during the process.
875873 */
876874 @Throws(IllegalArgumentException ::class , IOException ::class )
877- fun sendRefreshToken (): Boolean {
878- if (disableAutoRefresh) {
875+ fun sendRefreshToken (isManualCall : Boolean = false): Boolean {
876+ // Only block automatic refresh operations, not manual calls
877+ if (! isManualCall && disableAutoRefresh) {
879878 return false
880879 }
881880
0 commit comments