【发布时间】:2015-08-20 22:05:24
【问题描述】:
我们正在使用Resource Owner Credentials 使用我们的内部OAuth Svr 获取访问令牌。如果网址中不包含任何 https,则一切正常,但是当我在其中包含 https 时,一切都失败了。
我们使用https 部署了所有站点:
遵循一个非常简单的失败代码。如果我在其中包含https,我不知道为什么会出现异常。
try
{
http_client api(U("https://172.27.12.207/AuthSvr"), m_http_config);
ucout << "Requesting account information:" << std::endl;
ucout << "Information: " << api.request(methods::GET, U("identity/.well-known/openid-configuration")).get().extract_json().get() << std::endl;
//TestRestAPI().wait();
}
catch (...)
{
ucout << "Unknown Error";
}
编辑
我处理了异常以捕获web::http::http_exception,但我看到了错误:
WinHttpSendRequest: 12175: A security error occurred
【问题讨论】:
-
你能写出你得到了什么异常吗?
-
我处理了异常以捕获 web::http::http_exception 并且我看到错误“WinHttpSendRequest: 12175: 发生安全错误”
-
问题出在证书验证上。由于大多数开发环境使用自签名证书,验证失败导致 HTTPS 事务失败。解决方法是禁用证书验证。
-
将此粘贴为答案。
标签: c++ https casablanca