https://kotlinlang.org logo
#ktor
Title
# ktor
n

natario1

09/13/2021, 2:10 PM
How do you reset the auth tokens previously passed to
install(Auth) { bearer { ... } }
? We're having serious issues after logout/re-login, because apparently ktor keeps the old token in memory (loadTokens / refreshTokens not called). Using ktor client 1.6.0.
Ok I found it -
Copy code
client[Auth].providers.filterIsInstance<BearerAuthProvider>().forEach {
    it.clearToken()
}
r

Rustam Siniukov

09/13/2021, 2:32 PM
there is a bug in 1.6.0 that prevents tokens from being re-requested. fixed in 1.6.3
n

natario1

09/13/2021, 2:35 PM
You mean after 401? The code above seemed to solve my issue, but I'll upgrade anyway. Thanks!
👍 1
r

Rustam Siniukov

09/13/2021, 2:54 PM
Some versions prior to 1.6.3 were not updating token after calling to
clearToken
4 Views