Announcement

Collapse
No announcement yet.

Betfair API Login - TLS 1.2 - from 19th February 2019

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • schmoopie
    replied
    Hi. What about Visual Basic? I use VBA macros in Excel to run my login.

    I can no longer login using my script

    (The resources - as usual - show Python and others - any info for VB?)

    Please help

    Leave a comment:


  • schmoopie
    replied
    Help please! Visual Basic (VBA)

    I am not a programmer! But I've scambled together thousands of lines that work automatically on the Betfair API (or have until now). Does anyone know what I need to change here??

    ----

    Function SendLoginRequest(url, appkey, username, password) As String
    On Error GoTo ErrorHandler:

    Dim xhr: Set xhr = CreateObject("WinHttp.WinHttpRequest.5.1")
    Dim myToken As String

    With xhr
    .Open "POST", url & "/", False
    .setRequestHeader "X-Application", appkey
    .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    .setRequestHeader "Accept", "application/json"

    End With


    xhr.Send "username=" & username & "&password=" & password
    SendLoginRequest = xhr.responseText

    If xhr.Status <> 200 Then
    Err.Raise vbObjectError + 1000, "Util.SendRequest", "The call to API-NG was unsuccessful. Status code: " & xhr.Status & " " & xhr.statusText & ". Response was: " & xhr.responseText
    End If


    Set xhr = Nothing

    On Error GoTo 0
    Exit Function

    ErrorHandler:
    HandleError "SendRequest"
    'Resume Next


    End Function

    Leave a comment:


  • Mike2609
    replied
    Sorted it
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

    Leave a comment:


  • Mike2609
    replied
    Mine is 4.5

    Leave a comment:


  • LetsGo
    replied
    Originally posted by Mike2609 View Post
    What do I have to change in VB.NET. I can no longer log in
    Go to Project->Properties... and check what version of .NET Framework you are targeting.
    I think 4.6.1 is the latest.

    Leave a comment:


  • Mike2609
    replied
    What do I have to change in VB.NET. I can no longer log in

    Leave a comment:


  • OzPunter
    replied
    Thanks for the helpful advice LetsGo, but I scan my computer regularly and kill off anything suspicious. I did check the .dll's and because the dates were 2018, I assumed [erk] that they were the current versions. The problem stopped immediately I downloaded the new .dll's. I was in a bit of a panic because I have several programs that use the BF API and I was visioning complete failure. Apparently only the Login, Logout & Keep alive functions were affected. Its strange that my Logout was the only function affected but my KeepAlive function went merrily on. The login uses the interactive (web) login so that always worked.

    Thanks for your concern LetsGo, helpful advice.

    Kind Regards
    OzPunter

    Leave a comment:


  • LetsGo
    replied
    Originally posted by OzPunter View Post
    Problem solved.. When all else fails check the obvious. (Always the last thing to do) I updated libeay32.dll and ssleay32.dll from https://indy.fulgan.com/SSL/ and all is well. I did check the dates on my original files they were dated 2018 so I figured they were the latest, no so apparently.

    If anyone else is having this problem, do this first instead of (like me), last.

    Kind Regards
    OzPunter
    If you're doing that you must have a problem with your Windows installation, there maybe other issues that you don't know about.
    Conduct a full malware Scan of your PC, make sure your Windows is uptodate ect.

    Leave a comment:


  • OzPunter
    replied
    Problem solved.. When all else fails check the obvious. (Always the last thing to do) I updated libeay32.dll and ssleay32.dll from https://indy.fulgan.com/SSL/ and all is well. I did check the dates on my original files they were dated 2018 so I figured they were the latest, no so apparently.

    If anyone else is having this problem, do this first instead of (like me), last.

    Kind Regards
    OzPunter

    Leave a comment:


  • LiamP
    replied
    Originally posted by OzPunter View Post
    I think I've solved the problem,, (Possibly)

    I found this site https://indy.fulgan.com/SSL/ and downloaded the two DLL's, (libeay32.dll and ssleay32.dll) then installed the two .DLL's into my windows system path and the fault stopped occurring..

    I have only briefly tested the code but it's looking promising..

    Regards
    OzPunter
    That site looks official.. good luck

    Leave a comment:


  • OzPunter
    replied
    I think I've solved the problem,, (Possibly)

    I found this site https://indy.fulgan.com/SSL/ and downloaded the two DLL's, (libeay32.dll and ssleay32.dll) then installed the two .DLL's into my windows system path and the fault stopped occurring..

    I have only briefly tested the code but it's looking promising..

    Regards
    OzPunter

    Leave a comment:


  • OzPunter
    replied
    In relation to the new TLS 1.2 protocol the choices I have for the INDY HTTPClient are

    sslvSSLv2
    sslvSSLv23
    sslvSSLv3
    sslvTLSv1
    sslvTLSv1_1
    sslvTLSv1_2

    I've tried every setting and the ALL Fail..

    Does anyone know how to set the Indy HTTPCLIENT to a setting that Betfair servers accept?

    httpClient.Request.CustomHeaders.Add('X-Application:' + App_Key ) ;
    sslIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil) ;
    sslIOHandler.SSLOptions.Method := sslvTLSv1_2;
    sslIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2];
    httpClient.IOHandler := sslIOHandler ;
    Response := httpClient.Get('https://identitysso.betfair.com/api/logout') ; < --- This line Fails

    There is lots of chatter on the internet about the SSL3_GET_RECORD: Wrong Version Number error, many suggest that Wireshark shows it as a server problem.

    I have searched for a solution and have drawn a blank, I don't know if its a server issue or not, but I can say its frustrating..

    OzPunter

    Leave a comment:


  • OzPunter
    replied
    Hi,
    I am having a problem with the new TLS protocol.

    Firstly, I have no problem with logging in, I can use all the functions like getting prices, placing bets etc, everything EXCEPT Logout.

    The code for logging out is identical to all the other functions that work fine except when I call logout I get an error SSL3 GET_Record wrong version number.

    The code logs out by calling httpClient.Get('https://identitysso.betfair.com/api/logout') ;

    everything else works and I didn't need to change anything. It seems that windows 10 selects the correct SSL protocol, so why doesn't the log out work?

    Kind Reagrsd
    OzPunter

    Leave a comment:


  • Vadimaster1
    replied
    Originally posted by WTPooh View Post

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    Just add this line to your program.
    Thank you so much! It works great!

    Leave a comment:


  • GC
    replied
    Thanks WT, you've saved my life! A pity simple solutions like this aren't publicized by BF when they make these edicts

    Leave a comment:

Working...
X