Hello,
I have a website protected with a basic authentication, which launch an ActiveX using WinHttp to communicate to the same website.
As is, it doesn't work without manual re-authentication within my application.
I would like to somehow retrieve the first authentication credentials and re-use it with WinHttp, like WinInet does (with its Credential cache)
I've read about WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS in https://msdn.microsoft.com/en-us/library/windows/desktop/aa384066(v=vs.85).aspx
It is supposed to enable authentication using WinInet credentials.
The problem is I can't make it work, and can't find any more detailed documentation or example.
What is this "last resort" using global credentials, how is it triggered from code ?
The credentials are "pushed down from WinInet", am I supposed to collect them somehow, or is it all wrapped by WinHttp ?
It seems related to the other flag WINHTTP_OPTION_GLOBAL_SERVER_CREDS, is that how am I supposed to retrieve any credentials ?
How am I supposed to fill the WINHTTP_CREDS_EX structure to make it work ?
For now, I have tested WinHttpSetOption with WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS set to TRUE, the method returns TRUE.
I failed setting the credentials for the appropriate scheme with WinHttpSetCredentials and NULL for username & password (ERROR_INVALID_PARAMETER as long as username is NULL or empty)
I also tested WinHttpSetOption with WINHTTP_OPTION_GLOBAL_SERVER_CREDS and an empty WINHTTP_CREDS_EX struct with no hInternet parameter, without success (ERROR_WINHTTP_INVALID_OPTION)
I also tried WinHttpQueryOption, with WINHTTP_OPTION_GLOBAL_SERVER_CREDS flag, without success.
Any idea on how to make it work ?
Thanks,