2016-04-29 33 views
0

我正在使用此方法登錄betfair api。一切工作正常,但在Windows 10更新(KB3140741)不再工作後。 ResponseText = {「loginStatus」:「CERT_AUTH_REQUIRED」}任何人都解決了這個問題?Windows 10更新後的非交互式api登錄

的Windows 10構建10586.218,版本1511 的Microsoft Office 2016

Dim oHTTP As Object: Set oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") 
Dim uri As String: uri = "https://identitysso.betfair.com/api/certlogin" 
oHTTP.Open "POST", uri, False 
oHTTP.SetClientCertificate "Common Name" 
oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
oHTTP.setRequestHeader "X-Application", App_key 
oHTTP.setRequestHeader "Accept", "application/json" 
oHTTP.send "username=" & UserName & "&password=" & Password & "" 
+0

任何人有什麼想法?仍然沒有成功贏得10 – TheOlis

回答

0

我會嘗試用Msxml2.ServerXMLHTTP.6.0代替:

Const uri = "https://identitysso.betfair.com/api/certlogin" 

Dim req As Object 
Set req = CreateObject("Msxml2.ServerXMLHTTP.6.0") 

req.Open "POST", uri, False 
req.setOption 2, 13056   ' ignore all certificate errors ' 
req.setOption 3, "Common Name" ' set the client certificate from the local store ' 
req.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
req.setRequestHeader "X-Application", App_key 
req.setRequestHeader "Accept", "application/json" 
req.send "username=" & UserName & "&password=" & Password & "" 
+0

我想保留證書登錄。沒有證書我的方法也起作用。在Windows 7上,即使證書登錄也可以正常工作 – TheOlis

+0

也可以使用帶'.setOption 3'的證書'Msxml2'設置客戶端證書' –

+0

'與WinHttp.WinHttpRequest.5.1'相同的結果這很奇怪,在Windows更新之前,它工作正常。 – TheOlis