angularjs https 请求上的 Cordova 证书错误

Cordova certificate error on angularjs https request

我正在构建一个内部 cordova 应用程序,并且在将请求 url 从 http 更改为 https 时遇到了一个奇怪的错误: "XMLHttpRequest: Network Error 0x800c0019, Security certificate required to access this resource is invalid."

当我从我的浏览器调用此 url (https://something/something) 时,我正常收到 JSON 响应而没有任何消息(证书似乎没问题)。

但是当我使用 angular $http.get:

从我的 cordova 应用程序(windows 10 build)调用它时
$http.get(myurl).success(function (data) {
$scope.doSomething();
}).error(function (data, status) {
$scope.handleHttpError();
});

我收到网络错误消息。

我需要启用 "sharedUserCertificates" 功能吗? 任何建议将不胜感激。提前谢谢你。

答案是肯定的。您必须启用 "sharedUserCertificates"。我找到的方法是这样的:

1) 打开 xml 文件: (ThePathToYourApplication)\platforms\windows\package.windows10.appxmanifest

2) 转到功能部分并添加以下内容: uap:Capability 姓名="sharedUserCertificates"

3) 构建并准备就绪。