Cordova certificate error on angularjs https request

0

I am building an in-house cordova application and have come across with a strange error when changing the request url from http to https: "XMLHttpRequest: Network Error 0x800c0019, Security certificate required to access this resource is invalid."

When I call this url (https://something/something) from my browser, I get the JSON response normally without any messages (the certificate appears to be OK).

But when I call it from my cordova app (windows 10 build) using angular $http.get:

$http.get(myurl).success(function (data) {
$scope.doSomething();
}).error(function (data, status) {
$scope.handleHttpError();
});

I get the network error message.

Do I need to enable "sharedUserCertificates" capability ? Any suggestion will be appreciated. Thank you in advance.

javascript
angularjs
cordova
certificate
asked on Stack Overflow Jan 16, 2017 by Peteperson

1 Answer

0

The answer is yes. You must enable "sharedUserCertificates". The way I found how to do it is this:

1) Open xml file : (ThePathToYourApplication)\platforms\windows\package.windows10.appxmanifest

2) Go to section Capabilities and add this: uap:Capability Name="sharedUserCertificates"

3) Build and you are ready.

answered on Stack Overflow Jan 16, 2017 by Peteperson • edited Jan 16, 2017 by Peteperson

User contributions licensed under CC BY-SA 3.0