Hi, I'm using for a client the `BasicAuthCredentia...
# ktor
a
Hi, I'm using for a client the
BasicAuthCredentials
but I'm having weird results, as in the function I'm querying username/password from a storage, but it appears to only query it on the first request that requires auth, then never again, not updating the values used by
BasicAuthCredentials
. Here is my code :
Copy code
install(Auth) {
	basic {
		credentials {
			val username = storage["username"] ?: ""
			val password = storage["password"] ?: "" // will only get the values the first time

			if (username.isEmpty() || password.isEmpty()) null
			else BasicAuthCredentials(username, password)
		}
		realm = "Login"
	}
}
Even putting logs in this lambda shows that it's only called once, but then, how do I tell my Ktor to update its credentials ?
a
This is an expected behavior because the credentials are cached when the lambda is called for the first time.
a
Ah, how can I update the credentials then ?