I have a problem that I havent been able to solve, I am connecting my Android app to a Laravel API, everything is working well, but when I try to send the JsonObject for the Post request it returns a 500 (I know 500 is an error of the server side, but Dingo likes to throw that code). The problem is, I just get this error when sending the JsonObject with the String variable names, but when I send the literal String, everything works fine. Ive already tried encoding to UTF-8. What could it be? I will leave my code below.
This way it works:
private void authorizeClient(String name, String secret, String ID){
RequestQueue requestQueue = Volley.newRequestQueue(this);
JSONObject jsonObject = new JSONObject();
try{
String secretFinal = URLEncoder.encode(secret, "UTF-8");
jsonObject.put("grant_type", "client_credentials");
jsonObject.put("name", name);
jsonObject.put("client_secret", "c3melO2KvDQ:APA91bHYvSUJsSkB3dOKwk8zfgG0");
jsonObject.put("client_id","287cdh27ldns7isvw7e3sd47ngau37t449123456");
This way it doesnt work:
private void authorizeClient(String name, String secret, String ID){
RequestQueue requestQueue = Volley.newRequestQueue(this);
JSONObject jsonObject = new JSONObject();
try{
String secretFinal = URLEncoder.encode(secret, "UTF-8");
jsonObject.put("grant_type", "client_credentials");
jsonObject.put("name", name);
jsonObject.put("client_secret", secret);
jsonObject.put("client_id",ID);