I am sending a volley request like this
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//submitForm();
JsonObjectRequest jsonobjectRequest = new JsonObjectRequest(Request.Method.POST, URL, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
//errorlabel.setText(response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
errorlabel.setText("Invalid username / password");
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("email", "[email protected]");
params.put("password", "asd");
return params;
}
};
errorlabel.setText(jsonobjectRequest.toString());
requestQueue.add(jsonobjectRequest);
}
});
}
But I get an error message from the server saying invalid email/password.
I have set up the correct params. I tested it out on Postman and it works in there. Here is a screenshot.
Screenshot

I had same problem and i tried with String request, its working
StringRequest jsonObjRequest = new StringRequest(Request.Method.POST,
URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
public String getBodyContentType() {
return "application/x-www-form-urlencoded; charset=UTF-8";
}
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> postParam = new HashMap<String, String>();
postParam.put("email", "[email protected]");
postParam.put("password", "asd");
return postParam;
}
};
requestQueue.add(jsonObjRequest);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With