I can’t get access to my API, I read, I need to create an authorization header, but I still get no access. What I do wrong, can someone help please, sitting long with this problem can’t continue my app building.
`iprivate fun sendRequestAndPrintResponse() {
val url = "https://api.wanikani.com/v2/assignments?burned=true&subject_types=vocabulary&levels=1,2,3,4,5,6,7,8,9,10,11,12,13"
val request = JsonObjectRequest(
Request.Method.GET, url, null,
Response.Listener<JSONObject> { response ->
try {
val jsonArray = response.getJSONArray("data")
for (i in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(i)
// Append character to textView here
val cha = jsonObject.getString("data")
//val burn = jsonObject.getString("user_specific")
//val burn2: Boolean = jsonObject.getBoolean("burned")
/*
* If the Kanji srs == burned
* Choose an random vocab
* Append to vocab variable
* */
val rand = chooseRandomVocab(cha)
vocab!!.append(rand.toString())
Log.i("myTag", "This is the kanji: $cha")
}
} catch (e: JSONException) {
e.printStackTrace()
}
}, Response.ErrorListener { error -> error.printStackTrace() })
getHeaders()
mQueue!!.add(request)
}
@Throws(AuthFailureError::class)
fun getHeaders(): Map<String, String>? {
val params: MutableMap<String, String> =
HashMap()
params["Authorization"] = "6c691219-b94e-4ea9-9f26-3cfe297b5516\t"
return params
}`