NativeScript: Getting json from webservice: Trust anchor for certification path not found

android

#1

Hi, I have really annoying problem with logging to server.

I would like to logging to server what is possible by login and password (OR certificate) to get json using webservice.
I run application on emulator via ANDROID STUDIO (api 26 or whatever it is problem appear). I use function for HTTP REQUEST like this:
(using nativescript-https plugin or without - using simple function like : http.request)

Https.disableSSLPinning();
Https.request({
url: adres,
method: ‘GET’,
headers: {
“Content-Type”: “application/json”,
‘Authorization’: 'Basic ’ + encodedStr,
},
}).then(function(response) {
console.log(response);
input.text="" + response.content;
//this.router.navigate(["/list"]);
console.log(‘response’, response)
}).catch(function(error) {
console.error(‘error’, error)
})

But I still getting ERROR:

JS: error javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I know that the problem dissappear when I installing certificate on emulator but only on api 22 or lower.
But I dont want to using any kind of certificate. I want to log in just by login and password.
I was looking for solving but nothing work properly. What is more, I know that it is not problem with server because when it was checked using CORDOVA, credentials login is possible.

Thank you for answering.