The login URL (endpoint) in my program has some sort of registration code included in it where the WebBrowser object is created and it may be that that code related to my program as registered with Betfair. The log in screen appears to be a Betfair screen. I'm wondering if I could delete the ssid file to trick my progam into going through the LoginForm code.
VBNet Sample (Yes really)
Collapse
This is a sticky topic.
X
X
-
Hi
Hmmm, what error does it give you now when you try and logon ? Use a sniffer tool to grab the comms strings see what goes up/down the wire.
I am not saying its wrong, but I dont really understand why that url line is so complicated and long.
My C# version is much simpler
string myStr = string.Format("https://identitysso.betfair.com/api/login?username={0}&password={1}", userName, password);
I just setup a few params like POST etc, and the headers and then a filled in myStr goes out on the wire.
That is working fine for me
Are you sure your Appkey is OK and works ?
Regards
Comment
-
Thanks all for perservering with me.
I am still getting "Login Problem The request was aborted:Could not create SSL/TLS secure channel.
I tried the simpler Login but gives same result.
Dim uri As String = String.Format("https://identitysso.betfair.com/api/login?username={0}&password={1}", username, password)
' Dim uri As String = String.Format("https://identitysso.betfair.com/api/login?username={0}&password={1}&login=true&redirec tMethod=POST&product=home.betfair.int&url=https://www.betfair.com/", username, password)
The App key is tried and tested on another program.
Comment
-
Code:Function Login(userName As String, password As String) As LoginResponse Dim request As HttpWebRequest = WebRequest.Create(New Uri("https://identitysso.betfair.com/api/login")) request.Headers.Add("X-Application", appKey) request.Accept = "application/json" request.ContentType = "application/x-www-form-urlencoded" request.Method = "POST" Dim postData = $"username={userName}&password={password}" Dim bytes = Encoding.UTF8.GetBytes(postData) request.ContentLength = bytes.Length Using stream = request.GetRequestStream() stream.Write(bytes, 0, bytes.Length) End Using Using response = request.GetResponse(), stream = response.GetResponseStream(), reader = New StreamReader(stream, Encoding.UTF8) Dim s = reader.ReadToEnd() Return JsonConvert.DeserializeObject(Of LoginResponse)(s) End Using End Function
Comment
-
-
1. Add a class LoginResponse to your project:
LoginStatusCode:Public Class LoginResponse <JsonProperty(PropertyName:="token")> Public token As String <JsonProperty(PropertyName:="product")> Public product As String <JsonProperty(PropertyName:="status")> Public status As LoginStatus <JsonProperty(PropertyName:="error")> Public [error] As String End Class
2. Replace appKey with the reference to your application key.Code:<JsonConverter(GetType(StringEnumConverter))> Public Enum LoginStatus SUCCESS LIMITED_ACCESS LOGIN_RESTRICTED FAIL End Enum
3. Replace
Dim postData = $"username={userName}&password={password}"
with
Dim postData = String.Format("username={0}&password={1}", userName, password)Last edited by WTPooh; 14-11-2020, 04:26 PM.
Comment
-
Hi guys, Ok so the program appears to login without error. Only problem is it doesn't load anything else ie. todays races , just pops up with "Todays Races".
Since i've made so many changes think i will delete and start again. "i will be back".
Comment
-
Hi guys not been around a while. Managed to sort out the login problems after upgrading to visual studio 2019. Worked out a selection plan and obtaining selection Id and market Id . Can anyone point me to a program for a simple back bet using basic.net
Comment


Comment