So I have just created a set of appkeys, and thought I'd try the SampleAPI c# login program. The problem is that the login process doesn't work properly for me. I keep getting the following error message when I try to log in (translated into English): "We have technical difficulties and can not continue with the login process. Try again later." I have tried both appkeys, and I've both tried appending my authenticator code at the back of my password and leaving it out, but I always get the same error message. I've verified that my appkey works with the visualiser. Any ideas what the problem might be?
SampleAPI login problem
Collapse
X
-
Tags: None
-
I've now read that it takes up to three working days before app keys are white-listed. I suppose the problem might be my impatience and failure to read FAQs? I suppose the app keys might work with the visualiser before they have been white-listed?
-
More than three working days have passed, but the problem persists.
Some additional information:
It's the program written by Betfair and made available for download on the page describing how to obtain a session token for the visualiser that I try to log in with.
The error message is displayed on a page with the following address: https://identitysso.betfair.com/view/login?product=MYAPPKEY&redirectMethod=POST
I get the same error message if I enter the wrong appkey, or the wrong username and/or wrong password. Only if I leave the fields for username and password blank do I get an error message saying that I have entered the wrong username or password, that both are case sensitive, and that after five attempts my account will be locked.
I have reset Internet Explorer 10 to its default settings, and checked that I can log in to Betfair using Internet Explorer.
My appkeys still work with the visualiser.
Is there anything else I can tell you that would help identify the exact problem?
Please help!
Comment
-
This works for me:
Code:public string Login(string username, string password) { string ssoid = String.Empty; string[] info; try { string uri = string.Format("https://identitysso.betfair.com/api/login?username={0}&password={1}&login=true&redirectMethod=POST&product=home.betfair.int&url=https://www.betfair.com/", username, password); HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(uri); myRequest.Method = "POST"; myRequest.Timeout = 5000; WebResponse thePage = myRequest.GetResponse(); info = thePage.Headers.GetValues("Set-Cookie"); int i = 0; while (ssoid == String.Empty && i < info.Length) { if (info[i].Contains("ssoid=")) ssoid = ExtractSSOID(info[i]); ++i; } } catch (System.Exception e) { Console.WriteLine("\nException Caught!"); Console.WriteLine("Message :{0} ", e.Message); } SessionID = ssoid; return ssoid; }
Comment
-
Thanks for sharing your code betdynamics! Much appreciated!
I haven't tried it yet, but I probably will next week (busy betting on the weekends!
Must say I'm a bit surprised to see that you can log in without using your appkey at all, and if I haven't misunderstood something it's optional to send it with your keep alive and logout requests too? In other words I don't really need any appkey (or certificate for that matter), just my username and password? (I have been reading about certificates today thinking that I would try the non-interactive login process instead.) When I read the login FAQ I got the impression that they didn't intend for it to be possible to log in using just username and password. Anyway, thanks again betdynamics!
If anyone has any idea what the reason for SampleAPI.exe not working for me might be I would still love to know though. The English version of my error message is "We are experiencing some technical issues and unable to proceed with your login. Please try again later". (I just found someone on the longer thread about the login process who had the same problem as I do. My translation was a bit off...).
Comment
-
Unfortunately that method didn't work either.
The responseurl I got was https:
//identitysso.betfair.com/view/login?redirectMethod=POST&errorCode=INPUT_VALIDATI ON_ERROR
Can anyone please tell me what the reason for INPUT_VALIDATION_ERROR might be?Last edited by Mr.Anderson; 03-12-2013, 05:23 PM.
Comment
-
Today I tried to log in again after a few months of not thinking about API-NG.
I still get "We are experiencing some technical issues and unable to proceed with your login. Please try again later".
This time around however I noticed some hidden lines in the address of the error message.
After: https://identitysso.betfair.com/view...ectMethod=POST
which was the only part I noticed in November follows: &errorCode=FORBIDDEN&url=https********www.betfair.com
(don't think ******** is sensitive, but I replaced with stars just in case)
I also tried disabling two-step authentication today, but that didn't make any difference.
You think it's because my appkeys never were whitelisted like they should have been months ago?
Comment
-
I am not familiar with C# much but I have been able to get the Excel sample workbook to work with the app keys I generated and the session cookie I manually retrieved.
If you want to verify that your app key and session cookie work (or don't work), download the SampleCode workbook, enter your app key and session cookie in the designated cells. Then click either the JSON or REST button. If you have a working app key, the cells should be populated with data.
Comment
-
Hi Mr AndersonOriginally posted by Mr.Anderson View Posthttps://identitysso.betfair.com/view...ectMethod=POST
which was the only part I noticed in November follows: &errorCode=FORBIDDEN&url=https********www.betfair.com
Its not quite clear what you are trying to do or what Country you are from as Betdynamics log in sample should work with the right endpoint
Its what I have been using in my App and its Cool
I am now using this new one Ive done Below
If I try to login with the uRL above I also get Forbidden and if I try a Normal request I get Validation Error
As Usual the documentation is garbage as it seems to Address only Tech Guys with Geek Speak and is a Joke
Anyway after a bit of playing I found the Problem is in the actual request Url (It needs the inclusion of Username and password in the request string!) This works perfectly from UK with VBNet I dont know C# so I have converted it after the VBNet Code (Sorry if this code is incorrect) so have another Go if you have any Valium left lol
You dont actually need any AppKeys in fact you can use anything in the X-Application (See Code) Totally weird its just for Error reasons it says in Doc
VBNet Login and get Status and the Session Token
Code:Private Sub Login() '=============Interactive Login for a Desktop App================== '** First get your required Endpoint if you are not a UK or International User see Documentation For Login URL definition 'identitysso.betfair.com '~~> UK and International users (for Aus as well?) 'identitysso.betfair.es '~~> Spanish 'identitysso.betfair.it '~~> Italian 'identitysso.w -con.betfair.com '~~> These 2 are Listed in Non-Interactive Doc? 'identitysso.betfaironline.eu 'Europe Dim strUserEndpoint As String = "https://identitysso.betfair.com/api/login" '~~> UK and International '======== Construct the UserName and Password String ============= '~~> This is the "Do Our Heads in Bit" EG: The UserName and Password HAS to be part of the Request String Itself! Dim strUserName As String = txtUserName.Text '~~> Your userName Dim strPassword As String = txtPassword.Text '~~> Your password Dim strID As String = "?username=" & strUserName & "&password=" & strPassword '========= Construct the Full Request Url ========= Dim strUrl As String = strUserEndpoint & strID '===== Now just make the Normal Json request as used in the Logout and KeepAliv e============== Dim htRequest As HttpWebRequest = Nothing '~~~> *NOTE* HttpWebRequest NOT WebRequest Dim htResponse As Net.HttpWebResponse = Nothing '~~~> *NOTE* HttpWebResponse NOT WebResponse Dim oResponseStream As IO.StreamReader = Nothing '~~> Get the Text Stream Dim strResponseText As String = "" '~~> Holds the Response message for display if required Try htRequest = WebRequest.Create(strUrl) '~~~> *Create Web Request With htRequest '~~> To accept Json .Method = "POST" '~~> Not GET .ContentType = "application/json" '~~> Normal .Timeout = 5000 '~~> Optional .Accept = "application/json" '~~> Required '~~> Add Headers <~~' .Headers.Add(HttpRequestHeader.AcceptCharset, "ISO-8859-1,utf-8") '======= THIS is STRANGE! ============== '.Headers.Add("X-Application", txtLiveKey.Text) '~~~> Use App Key here SEE BELOW! .Headers.Add("X-Application", "CallmeAnyting") '~~> Use Product Key if required but you can Call this anything by look of it End With 'htRequest '~~> Get the response and return the Status and Session Token<~~' htResponse = htRequest.GetResponse If htResponse.StatusCode = Net.HttpStatusCode.OK Then '~~> Proceed to get the Response details oResponseStream = New IO.StreamReader(htResponse.GetResponseStream()) '~~> Convert to text strResponseText = oResponseStream.ReadToEnd() '~~> Read all the Text to the String Variable Else '~~> Get outa here Exit Sub End If 'Ht Error Check Catch ex As System.Exception ' txtLog.Text = "Login Problem" & vbCrLf & ex.Message MsgBox("Login Problem" & vbCrLf & ex.Message) '==Clean Up== htRequest = Nothing htResponse = Nothing oResponseStream.Close() oResponseStream = Nothing End Try '===== Display Results and for Editing ===== MsgBox(strResponseText) ' txtLog.Text = strResponseText '==Clean Up== htRequest = Nothing htResponse = Nothing oResponseStream.Close() oResponseStream = Nothing End Sub 'Login and get Session Token
And in C#
Hope this HelpsCode:private void Login() { //=============Interactive Login for a Desktop App================== //** First get your required Endpoint if you are not a UK or International User see Documentation For Login URL definition //identitysso.betfair.com '~~> UK and International users (for Aus as well?) //identitysso.betfair.es '~~> Spanish //identitysso.betfair.it '~~> Italian //identitysso.w -con.betfair.com '~~> These 2 are Listed in Non-Interactive Doc? //identitysso.betfaironline.eu 'Europe string strUserEndpoint = "https://identitysso.betfair.com/api/login"; //~~> UK and International //======== Construct the UserName and Password String ============= //~~> This is the "Do Our Heads in Bit" EG: The UserName and Password HAS to be part of the Request String Itself! string strUserName = txtUserName.Text; //~~> Your userName string strPassword = txtPassword.Text; //~~> Your password string strID = "?username=" + strUserName + "&password=" + strPassword; //========= Construct the Full Request Url ========= string strUrl = strUserEndpoint + strID; //===== Now just make the Normal Json request as used in the Logout and KeepAliv e============== HttpWebRequest htRequest = null; //~~~> *NOTE* HttpWebRequest NOT WebRequest Net.HttpWebResponse htResponse = null; //~~~> *NOTE* HttpWebResponse NOT WebResponse IO.StreamReader oResponseStream = null; //~~> Get the Text Stream string strResponseText = ""; //~~> Holds the Response message for display if required try { htRequest = WebRequest.Create(strUrl); //~~~> *Create Web Request var _with1 = htRequest; //~~> To accept Json _with1.Method = "POST"; //~~> Not GET _with1.ContentType = "application/json"; //~~> Normal _with1.Timeout = 5000; //~~> Optional _with1.Accept = "application/json"; //~~> Required //~~> Add Headers <~~' _with1.Headers.Add(HttpRequestHeader.AcceptCharset, "ISO-8859-1,utf-8"); //======= THIS is STRANGE! ============== //.Headers.Add("X-Application", txtLiveKey.Text) '~~~> Use App Key here SEE BELOW! _with1.Headers.Add("X-Application", "CallmeAnyting"); //~~> Use Product Key if required but you can Call this anything by look of it //htRequest //~~> Get the response and return the Status and Session Token<~~' htResponse = htRequest.GetResponse; //~~> Proceed to get the Response details if (htResponse.StatusCode == Net.HttpStatusCode.OK) { oResponseStream = new IO.StreamReader(htResponse.GetResponseStream()); //~~> Convert to text strResponseText = oResponseStream.ReadToEnd(); //~~> Read all the Text to the String Variable //~~> Get outa here } else { return; } //Ht Error Check } catch (System.Exception ex) { // txtLog.Text = "Login Problem" & vbCrLf & ex.Message Interaction.MsgBox("Login Problem" + Constants.vbCrLf + ex.Message); //==Clean Up== htRequest = null; htResponse = null; oResponseStream.Close(); oResponseStream = null; } //===== Display Results and for Editing ===== Interaction.MsgBox(strResponseText); // txtLog.Text = strResponseText //==Clean Up== htRequest = null; htResponse = null; oResponseStream.Close(); oResponseStream = null; } //Login and get Session Token //======================================================= //Service provided by Telerik (www.telerik.com) //Conversion powered by NRefactory. //Twitter: @telerik //Facebook: facebook.com/telerik //=======================================================
Dave
Comment
-
Hi Bengtsson!
Thanks for your reply! My appkey works with that Excelfile, so yes it's valid, but does that also prove that it's been whitelisted though? It has worked with the visualiser from day one where I also borrowed a session token from my web browser.
Comment
-
Hi Davecon, thanks for your reply!
I'm from Sweden (now with 6.5% commission, thanks Betfair!), and I'm just trying to log in and obtain a session token without having to borrow one from my web browser!
I've tried the C# compiled log in program offered for download by Betfair (source code available at Github), as well as a vb.net log in program I borrowed from this forum, but it just doesn't work.
Should I use a different endpoint from British customers? I'm certainly not Spanish or Italian, and like you say those two other endpoints are not even mentioned in the section about interactive log in.
The reason I kind of suspect my appkeys have not been whitelisted is that the log in FAQ says:
"Why is my interactive login/logout request failing with errorCode=FORBIDDEN?
Your Application Key App Key & redirect URL has not yet been white-listed by Betfair. This is an issue of a time lag and does not require any additional action by the customer and will be resolved by Betfair. App Keys are white-listed to use the https://www.betfair.com redirect by Betfair within 3 working days of creation. We plan to make this an automated process so there is no lag."
I most definitely enter the correct username, password and app key.
Like you probably suspect I'm a novice programmer, but I was able to write my own program for APIv6 (and now I want to rewrite it for API-NG). It sure has become more difficult to get started for us amateurs.
Comment
-
Hi Mr Anderson.
Your App Key needs to be whitelisted to use the interactive login method.
If you can contact bdp@betfair.com with your App Key we can confirm if this has been done.
Thanks
Neil
Comment
-
Amples respected davecon. The part that is devoted to C#. Were conversion errors. Now formed a working example. Applied some simplifications: removed string operations - once formed the URL with the user name and password. Key also led directly when making a request.
Put on a blank form button. Assign it a click event. The whole procedure login registered in this event.
Instead UUU and PPP should specify credentials instead of the KKK - key. The report can be seen the response string and then extract it from the token.
Works for me.
Code:private void button_Login_Click(object sender, EventArgs e) { string strUrl = @"https://identitysso.betfair.com/api/login?username=UUU&password=PPP"; HttpWebRequest htRequest = null; WebResponse htResponse = null; StreamReader oResponseStream = null; string strResponseText = ""; try { htRequest = (HttpWebRequest)WebRequest.Create(strUrl); htRequest.Method = "POST"; htRequest.ContentType = "application/json"; htRequest.Timeout = 5000; htRequest.Accept = "application/json"; htRequest.Headers.Add(HttpRequestHeader.AcceptCharset, "ISO-8859-1, utf-8"); htRequest.Headers.Add("X-Application", "KKK"); htResponse = htRequest.GetResponse(); if (htResponse.ContentLength > 0) { oResponseStream = new StreamReader(htResponse.GetResponseStream()); strResponseText = oResponseStream.ReadToEnd(); } } catch (System.Exception ex) { MessageBox.Show("Login Problem" + ex.Message); htRequest = null; htResponse = null; oResponseStream.Close(); oResponseStream = null; } MessageBox.Show(strResponseText); htRequest = null; htResponse = null; oResponseStream.Close(); oResponseStream = null; }
Comment
-
-
Originally posted by mizar1 View Posthi davecon
VBnet the code does not work
by an error
I feel the new bees from Italy
{"token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","p roduct":"CallmeAnyting","status":"SUCCESS","error" :""}
sorry it all works
I have not, however, 'I figured out how to make a call to see sports or various markets
can you give me an example?
Comment


Comment