Is it possible to do a request inside load refresh...
# ktor
j
Is it possible to do a request inside load refresh token in the auth plugin without using another client?
r
There was a bug in 1.6.0 but was fixed in 1.6.1. What version do you use?
j
Not sure, but what bug?
That bug implies i haven’t to use another client?
As I saw in this issue which I think is what is fixed in 1.6.1, https://youtrack.jetbrains.com/issue/KTOR-2797, I have to use another client
r
Yes, because of this issue, users need to have separate client for refreshing tokens. It’s fixed now, so you can use single client.
j
Ah, I will check, thank you 🙏
But how I am able to use the same client and not another one?
Copy code
val client = HttpClient() {
    install(Auth) {
        bearer {
            loadTokens { ... }
            refreshTokens { how can I do the request here with client itself? }
        }
    }
}
I can't find any lambda which includes the client or a way to build/prebuild it for using inside that function
r
Oh, you are right, bad API design from us. Pls file an issue in youtrack, we will fix it. For now you can make an ugly hack with
lateinit var
.
j
Ah, thanks, I will
🙏 1