unable_to_verify_leaf_signature 从 AngularJs/Cordova 发帖时

unable_to_verify_leaf_signature when posting from AngularJs/Cordova

我 运行 在尝试使用来自我的 angularjs authService 的“https://localhost:44333/identity/connect/token”到我的身份服务器时 post 遇到以下错误,但是当我 post 来自 Postman 或 Fiddler 一切正常。

我自己创建了一个导入的证书,所以当我在浏览器中导航到 https://localhost:44333/identity 时一切正常。

我通过谷歌搜索了解到它与证书有关,但我只能在 node.js 上找到主题。我正在尝试从 angularjs 服务到我在上述 url 上使用 owin 自托管的 IdentityServer3 进行身份验证。

以下是我的 angulajs 登录代码:

var _login = function (credentials) {

    var user = { grant_type: 'password', username: credentials.userName, password: credentials.password, scope: 'salesApi' }

    var urlEncodedUrl = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': 'Basic ' + base64Encoded
    };

    console.log(base64Encoded);

    $http.post(serviceBase + 'connect/token', { headers: urlEncodedUrl }, { data: user }).success(function (data, status, headers, config) {

        localStorageService.set('authorizationData', { bearerToken: data.access_token, userName: credentials.userName });

        _authentication.isAuth = true;
        _authentication.userName = credentials.userName;
        _authentication.bearerToken = data.access_token;


    }).error(function (err, status) {
        console.log(err);
        _logOut();
    });
};

关于我遗漏了什么或如何解决此错误的任何想法?

更新:这实际上是纹波模拟器或 cordova 问题吗?

我遇到了同样的问题并解决了获取 API 与真实主机一起工作的问题。似乎是 Ripple 的问题。

如果有人仍然遇到同样的问题,可能值得在

尝试我的 Ripple 解决方案

我将添加我对上述 SO 问题的回答步骤,以防止进一步的反对票:

  1. 创建 运行 Chrome 的快捷方式并设置 --disable-web-security 标志。如果需要更多信息,请参阅我在
  2. 的回答
  3. 使用命令行或Visual Studio
  4. 启动Ripple
  5. 使用 1.
  6. 中的快捷方式启动 Chrome 的实例
  7. 浏览到您的 Ripple url 并通过 HTTPS 发出您的请求
  8. 这将失败,开发工具控制台将显示 POST https://mydomain:port/api_endpoint net::ERR_INSECURE_RESPONSE
  9. 在新标签页中浏览到您的 https://mydomain:port url
  10. 这将生成一个 "Your connection is not private" 网页。单击 "Advanced",然后单击 "Proceed to https://mydomain:port (unsafe)" 接受自签名 SSL
  11. 现在回到 Ripple 选项卡,尝试再次发出您的请求,它应该会成功。