(FIXED)Has any one worked with ktor before? i am h...
# multiplatform
a
(FIXED)Has any one worked with ktor before? i am having some trouble with token part. i.e is the loadTokens called on every request?.
install(Auth) {
bearer {
loadTokens {
m
I remember having problems with loadTokens, example when the user logout ktor keeps setting the old token. It's better to add a default request and set the token manually there to avoid this issue.
👀 1
a
To clear bearer tokens after logout you need to call
Copy code
httpClient.authProvider<BearerAuthProvider>()?.clearToken()
🙌 1
m
Nice, so by calling clearToken, loadTokens is going to be called in the next request right?
a
Yes, if authorization is required for the next request or if
sendWithoutRequest
is configured
👀 1
thank you color 1
j
Note that there's #ktor for the library specifically
a
Thanks all i ll try some of things and see if that works 🙂
@mohamed rejeb the logout part is exact issue i am facing..