Guys, hello. I’m trying to implement a token-refre...
# ktor
s
Guys, hello. I’m trying to implement a token-refresh logic in my app. So i went to Ktor -> Clients -> Features -> Auth article but there are no info about Bearer token (im not saying about JWT). Can you provide me some info or best practices how to implement “Authorization” header in the best way? Now my “api” code look like this:
Copy code
suspend fun someApiMethod(request: RequestObj): ResponseObj {
        val response = <http://client.post|client.post><HttpResponse> {
            contentType(ContentType.Application.Json)
            url {
                protocol = URLProtocol.HTTPS
                host = Route.BASE_URL
                encodedPath = Route.SOME_PATH
                headers
                    .append("Authorization", "Bearer ${MY_TOKEN_SHOULD_BE_THERE}")
            }
            body = request
        }
        return Json.parse(ResponseObj.serializer(), response.readText())
    }