kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale-android
Suppress some authentication noise in the log.
Most of this was added to debug issue !102. So these are vestigial. The exception here is the handling of AuthorizationException type 2. These are produced by racing authentication requests and are successfully managed. So we need not report these. Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale-android/-/merge_requests/342>develop
rodzic
10035aa5fe
commit
467556d75c
|
@ -53,9 +53,6 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
|
||||||
this@authorize.apply {
|
this@authorize.apply {
|
||||||
if (!Settings.isAnonymous()) {
|
if (!Settings.isAnonymous()) {
|
||||||
oAuth.state().let { state ->
|
oAuth.state().let { state ->
|
||||||
state.accessTokenExpirationTime?.let {
|
|
||||||
Log.i("Request.authorize()", "Accesstoken expiration: ${Date(it).format()}")
|
|
||||||
}
|
|
||||||
val old = state.accessToken
|
val old = state.accessToken
|
||||||
val auth = ClientSecretPost(oAuth.state().clientSecret)
|
val auth = ClientSecretPost(oAuth.state().clientSecret)
|
||||||
val done = CompletableDeferred<Boolean>()
|
val done = CompletableDeferred<Boolean>()
|
||||||
|
@ -64,10 +61,9 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
|
||||||
state.performActionWithFreshTokens(tokenService, auth) { token, _, e ->
|
state.performActionWithFreshTokens(tokenService, auth) { token, _, e ->
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
Log.e("Request.authorize()", "performActionWithFreshToken failed: $e")
|
Log.e("Request.authorize()", "performActionWithFreshToken failed: $e")
|
||||||
Log.e("Request.authorize()", Log.getStackTraceString(e))
|
if (e.type != 2 || e.code != 2002) {
|
||||||
}
|
Log.e("Request.authorize()", Log.getStackTraceString(e))
|
||||||
if (token == old) {
|
}
|
||||||
Log.i("Request.authorize()", "Accesstoken not renewed")
|
|
||||||
}
|
}
|
||||||
if (token != old && token != null) {
|
if (token != old && token != null) {
|
||||||
state.save()
|
state.save()
|
||||||
|
@ -150,4 +146,4 @@ inline fun <T, U, V, W, R> LiveData<T>.mergeWith(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun String?.toIntOrElse(default: Int): Int = this?.toIntOrNull(radix = 10) ?: default
|
public fun String?.toIntOrElse(default: Int): Int = this?.toIntOrNull(radix = 10) ?: default
|
||||||
|
|
|
@ -83,7 +83,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
|
||||||
refreshAccessToken(state, context)
|
refreshAccessToken(state, context)
|
||||||
} else {
|
} else {
|
||||||
state.isAuthorized
|
state.isAuthorized
|
||||||
}.also { it.logInfo("tryRefreshAccessToken()") }
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue