Hi! I have a question about Ktor Client Basic Auth...
# ktor
f
Hi! I have a question about Ktor Client Basic Authentication. I can change my password at runtime and I expect my auth headers to change. However while debugging I noticed that
credentials
log message gets called only at start. Can I get new auth data every request without interceptor?
Copy code
install(Auth) { 
    basic { 
        sendWithoutRequest { _ ->
            true
        }

        credentials {
            val auth = authData()
            if (auth.login.isEmpty() || auth.password.isEmpty()) {
                null 
            } else {
                Log.d("AuthData", "${auth.login} ${auth.password}")
                BasicAuthCredentials(username = auth.login, password = auth.password) 
            }
        }
    }
}
a
After invoking the
credentials
method, the Basic auth provider caches the returned result. Unfortunately, unlike the Bearer auth provider, the Basic auth provider doesn't expose a method for clearing the cache. Can you please file an issue with the description of your use case?
f
@Aleksei Tirman [JB] Here is the issue
👍 1