can any one help me refreshToken part i.e when 401...
# ktor
a
can any one help me refreshToken part i.e when 401 unauthorized
Copy code
HttpClient {
          install(Auth) {
                bearer {
                    sendWithoutRequest { request ->
                        request.url.host == "<https://test/login>"
                    }
                    refreshTokens {
                        get<AuthManager>().renewToken()
                    }
                }
            }
still the refreshToken block dosn't work i.e calls remain 401
a
So the problem is that the
refreshTokens
's block isn't called? Can you share the response from the server?
a
@Aleksei Tirman [JB] response from api's
{"data":{},"errors":[],"appId":5008,"message":"Unauthorized"}
iDK if this helps but i added this code block also it executes right!
HttpResponseValidator {
validateResponse { response ->
when (response.status.value) {
401 -> {
println("SHOULD REFRESHHH")
}
}
}
}
i can use it manually call my renewToken api call function (but there will be a problem since as the old tokens api will not be recalled i guess since they already return 401 status)
a
Can you share the response status code and the value of the
WWW-Authenticate
header?