Authenticating with Android

I’m trying to get the authentication token from Monzo as in the section ‘Exchange the authorization code’ in the docs.
When I make the request using httpie from the terminal I have no problem, but when I make the request using Volley I get a 400 response.
I’ve confirmed that I’m using Volley correctly using the https://postman-echo.com/post endpoint.

Does the following use of Volley look sensible? And is there anywhere I could look to get more information on the 400 response?

VolleyLog.DEBUG = true;
val jsonBody = JSONObject()

jsonBody.put("grant_type", "authorization_code")
jsonBody.put("client_id", "oauth2client_somestring")
jsonBody.put("client_secret", "mnzpub.somestring/somestring")
jsonBody.put("redirect_uri", "http://www.sample.com")
jsonBody.put("code", code)

val request = object : JsonObjectRequest(
    Method.POST, "https://api.monzo.com/oauth2/token", jsonBody,
    Response.Listener<JSONObject> {
        println("Got some response")
    },
    Response.ErrorListener {
        println("That didn't work!") }) {
    override fun getHeaders(): Map<String, String> {
        val params = HashMap<String, String>()
        params["Content-Type"] = "application/x-www-form-urlencoded; charset=utf-8"
        return params
    }
}

Just in case anyone else comes across this issue.

  1. There was an error in my code above: the header should say ‘application/json’.
  2. It looks like the API doesn’t support application/json, having done a bit of playing about in postman.