Hi, I was testing Ktor 3.0 beta and i ran into thi...
# ktor
a
Hi, I was testing Ktor 3.0 beta and i ran into this when upgrading
image.png
I use this function to clear my token in case of re-login/ login with other user
Any idea what is the equivalent of this for the new ktor version?
a
You can use a simplified method for getting the authentication provider -
HttpClient.authProvider<T>
so your code could be replaced with the following:
Copy code
fun clearAuthentication(networkClient: HttpClient): Unit? {
    return networkClient.authProvider<BearerAuthProvider>()?.clearToken()
}
👍 1
👍🏾 1
a
Good tip thanks :)