Android app gives an error on POST request:
com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
After google search I have discovered this error might be related to Unknown certificate authority.
So my questions are:
What certification authority service do you use to prevent this error?
This is my POST code below, perhaps there are some mistakes? - I use httpS in my url.
private void userRegistration(){
StringRequest stringRequest = new StringRequest(Request.Method.POST, url + REG, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getApplicationContext(), "Все прошло хорошо!", Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_SHORT).show();
}
}){
@Override
protected java.util.Map<String, String> getParams() throws AuthFailureError {
java.util.Map<String, String> params = new HashMap<String, String>();
params.put(EMAIL, userEmail);
params.put(PASSWORD, userPass);
return params;
}
};
final RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
I have already read these:
Official android tutorial about this mistake.
Some related questions (Q1 and Q2) on stackoverflow. Q1 (BNK answer) actually works for me and solved the problem but I believe there is a better way to work with HTTPS in Android.
This one didn't work for me.
Help me please! What the common way (best practices) to work with https using Volley? Maybe it just to buy certificate from well know authorities?