A sample client, written in C#, is available to demonstrate this process on Github. This is a C# project created under Visual Studio 2010, written against .Net 4, and is a Winforms Application.
The key steps demonstrated by this client are:
- Embed identitysso.betfair.com into your application
- Handle the login method and retrieval of a session token from the cookies
- Handle the keep alive method
- Handle the logout method
How it works
Upon start-up, the URL of the API login page is assigned to the web browser control:
When the web browser control receives data an event is triggered and the following function called:
Upon successful login the cookie is parsed for the SSOID. The webrowser control made invisible and the SSOID displayed in a TextBox. The keep-alive timer is started
Above the StartKeepAlive function simply starts a 15 minute timer which invokes function OnKeepAliveTimer.
OnKeepAliveTimer sends a Keep Alive message.
A message to this effect is then displayed.
Upon hitting the Logout button the following event handler is invoked:
The keep alive timer is closed. The logout url is sent and a Logged out message is displayed.