Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Ktor(client side) not authorizing JWT Token

$
0
0

Using ktor for client side.

fun main() {    runBlocking {        val client = HttpClient(Java) {        install(ContentNegotiation) {            json(Json {                prettyPrint = true                isLenient = true                ignoreUnknownKeys = true            })        }    }        val response: User = client.get(UserHttpRoutes.GET_CURRENT_AUTH_USER) {            headers {                append(HttpHeaders.Authorization, "Bearer zI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhdHVueTAiLCJlbWFpbCI6ImF0dW55MEBzb2h1LmNvbSIsImZpcnN0TmFtZSI6IlRlcnJ5IiwibGFzdE5hbWUiOiJNZWRodXJzdCIsImdlbmRlciI6Im1hbGUiLCJpbWFnZSI6Imh0dHBzOi8vcm9ib2hhc2gub3JnL1RlcnJ5LnBuZz9zZXQ9c2V0NCIsImlhdCI6MTcxNjA1NzY5NSwiZXhwIjoxNzE2MDYxMjk1fQ.1LWhpQm_nQL1TsgDfVhN2P4dwDijSIqMN_E5_P-mh7w")            }        }.body()        println(response)    }}

This token was returned while signing in with that user. A json with empty fields is returned. Same happens when i damage the token, just deleting any word.

Edit: The server is free for everyone to use. website is dummyjson


Viewing all articles
Browse latest Browse all 3630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>