I need to access https://api-sandbox.direct.yandex.com/json/v5/campaigns via WinHttp
. Problem is that from a webbrowser it's work fine, but from WinHttp
it's failed with "A certificate is required to complete client authentication". I m under delphi
and Windows if it's matter.
Asked
Active
Viewed 1,449 times
0

zeus
- 12,173
- 9
- 63
- 184
-
Because https is a secure connection, and it needs a certificate to make the connection. The S at the end of https indicates that it's HTTP over SSL. – Ken White Mar 02 '20 at 00:25
-
2@KenWhite WinHTTP supports HTTPS, though. The issue seems to be that the *server* is asking for a certificate from the *client*, which is not usual but not unheard of. Such a certificate is likely installed in the user's web browser, but is not installed where WinHTTP can find/use it. – Remy Lebeau Mar 02 '20 at 04:20
-
Web browser can select appropriate certificate from certificate store (either user store or computer store). You need to [instruct WinHTTP to pick one](https://learn.microsoft.com/en-us/windows/win32/winhttp/ssl-in-winhttp#client-certificates) when making a request to server. You might as well need to grant access to certificate's private key to user account that runs your application, if it is located in computer store. – Peter Wolf Mar 02 '20 at 10:10
-
@RemyLebeau yes exactly, working with https is not a problem most of the time! the probleme is that https://api-sandbox.direct.yandex.com/json/v5/campaigns require me a certificate and I never did this before. I will look the link of peter – zeus Mar 02 '20 at 15:09