Hi There, I have recently updated Ktor from 2.3.1...
# ktor
s
Hi There, I have recently updated Ktor from 2.3.11 to 3.0.3 and started seeing providers not found, what is the alternative to clearToken
Copy code
httpClient.plugin(Auth).providers.filterIsInstance<BearerAuthProvider>()
    .firstOrNull()?.clearToken()
also
application
not found
Hi can someone help me on this. Struggling to get alternative in latest ktor 3.0.3
d
Hello @Suresh Maidaragi, Have you checked this issue? Looks like there's an alternative to reach the provider. https://youtrack.jetbrains.com/issue/KTOR-6382/Unable-to-access-providers-of-the-Auth-plugin-in-Ktor-3.0.0
s
thanks @Dieppa only got the solution for
httpClient.plugin(Auth).providers.filterIsInstance<BearerAuthProvider>()
.firstOrNull()?.clearToken()
but not for
server?.application?.isActive.isTrue()
and also for this no alternatives found...
d
Looks like your server object is
NettyApplicationEngine
type but
embeddedServer
function creates an
EmbeddedServer.
Try changing the server object type to
EmbeddedServer<NettyApplicationEngine, NettyApplicationEngine.Configuration>
s
awesome thanks 🙏
a
In Ktor 3.*, you can use the following code to clear the tokens:
Copy code
client.authProvider<BearerAuthProvider>()?.clearToken()
s
thanks @Aleksei Tirman [JB]
h