Skip to content

Commit

Permalink
Merge pull request #1575 from dhis2/androsdk-1391
Browse files Browse the repository at this point in the history
fix: [ANDROSDK-1391] Download token using IO scheduler
  • Loading branch information
vgarciabnz authored Jun 10, 2021
2 parents 51116e3 + aa392ab commit ec9f664
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import android.content.Intent
import dagger.Reusable
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.schedulers.Schedulers
import javax.inject.Inject
import net.openid.appauth.*
import org.hisp.dhis.android.core.user.User
Expand Down Expand Up @@ -71,9 +72,11 @@ internal class OpenIDConnectHandlerImpl @Inject constructor(
Single.error<User>(ex)
} else {
val response = AuthorizationResponse.fromIntent(intent)!!
downloadToken(response.createTokenExchangeRequest()).map {
logInCall.blockingLogInOpenIDConnect(serverUrl, it)
}
downloadToken(response.createTokenExchangeRequest())
.observeOn(Schedulers.io())
.map {
logInCall.blockingLogInOpenIDConnect(serverUrl, it)
}
}
} else {
Single.error<User>(RuntimeException("Unexpected intent or request code"))
Expand Down

0 comments on commit ec9f664

Please sign in to comment.