I have a problem here, I'm using okhttp 3 to pass some parameters to my php script. It worked when i use http:// but when i change to https:// it always says error.
This is my log:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
This is portion of my code:
OkHttpClient client = new OkHttpClient();
            RequestBody requestBody = new MultipartBody.Builder()
                    .setType(MultipartBody.FORM)
                    .addFormDataPart("username", txtUsername.getText().toString())
                    .addFormDataPart("password", txtPassword.getText().toString())
                    .build();
            Request request = new Request.Builder()
                    .url(my_https_url)
                    .post(requestBody)
                    .build();
            client.newCall(request).enqueue(new Callback() {
                @Override
                public void onFailure(Call call, IOException e) {
                    Log.e("Error", e.toString());
                    backgroundThreadShortToast(getApplication(), "Something Happened");
                }
                @Override
                public void onResponse(Call call, final Response response) throws IOException {
                    final String responseData = response.body().string();
                    //backgroundThreadShortToast(getApplication(), responseData);
                    LoginActivity.this.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if(responseData.equals("Login Failed")){
                                Toast.makeText(LoginActivity.this, "Username atau password salah", Toast.LENGTH_SHORT).show();
                                clickcount=clickcount+1;
                                if(clickcount==5)
                                {
                                    btnLogin.setEnabled(false);
                                    new Handler().postDelayed(new Runnable()
                                    {
                                        public void run()
                                        {
                                            btnLogin.setClickable(true);
                                            clickcount = 0;
                                        }
                                    }, 5000);
                                }
                            }else{
                                id_user = responseData;
                                checkVer();
                            }
                        }
                    });
                }
            });
When i run my code, it always go to onFailure. I have search some information in another article but i don't get the answer. Can somebody help me? Thanks for your help before.
 
    