Hamza
06/08/2020, 2:21 PMHttpClient().use { client ->
val response = client.submitForm<HttpResponse>(
url = "<https://discord.com/api/oauth2/token>",
formParameters = Parameters.build {
append("client_id", config.discord.client)
append("client_secret", config.discord.secret)
append("grant_type", "authorization_code")
append("redirect_uri", config.discord.redirect)
append("scope", "identify")
append("code", code)
})
println(response.readText()) // throws an error if response status is not 200.
}
andev
06/08/2020, 2:27 PMHamza
06/08/2020, 2:28 PMandev
06/08/2020, 2:29 PMval client = HttpClient{
expectSuccess = false
}
Hamza
06/08/2020, 2:31 PM