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

Javier

07/28/2021, 12:55 PM
Is it possible to do a request inside load refresh token in the auth plugin without using another client?
r

Rustam Siniukov

07/28/2021, 12:57 PM
There was a bug in 1.6.0 but was fixed in 1.6.1. What version do you use?
j

Javier

07/28/2021, 1:04 PM
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

Rustam Siniukov

07/28/2021, 1:12 PM
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

Javier

07/28/2021, 1:13 PM
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

Rustam Siniukov

07/28/2021, 5:39 PM
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

Javier

07/28/2021, 5:48 PM
Ah, thanks, I will
🙏 1
9 Views