Session Keys? Do they lock and need to be logged off.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harryknackers
    Junior Member
    • Jan 2013
    • 2

    #1

    Session Keys? Do they lock and need to be logged off.

    Need some slight guidance, as this is kind off doing my head in...

    I am an older programmer, still using VB6, but ultimately ALL my software is VB6 and runs perfectly and I usually don't have an issue connecting to modern day systems.

    However, with Betfair I am encountering an issue, that is proving hard to debug.

    I have a login session using a MSXML2.XMLHTTP object to connect to https://identitysso.betfair.com.au/api/login

    This section works perfectly ALL the time, I receive a JSON response {'token";'[SESSION KEY]","product":"[PRODUCT KEY]",'status";"SUCCESS",'error":""}, so I get the session key..

    I then do a listeventscall to the URL https://api.betfair.com/json-rpc/ with a request string of "{""jsonrpc"": ""2.0"", ""method"": ""SportsAPING/v1.0/listEventTypes"", ""params"": {""filter"":{}}, ""id"": 1}"

    What is happening is:

    When I first do the login I get a JSON list of events as expected, and whilst I have that session open, I can continually use the List Events Call and I receive that data, remembering I am testing and debugging development.

    However, as soon as I exit my software, which releases my session variable, and I reload my test program and use the login process again, which gets another session key perfectly, then I try the same function to call the ListEventscall I receive a 'INVALID_SESSION_INFORMATION", and this doesn't clear for a while, I can turn computer off etc... basically anything, and the same Invalid Session Information appears (Login process appears fine though).

    Is this because the initial session key is still in the system, and basically locking any other requests until the original session times out??

    And what's the best practice process? Logout no matter what after each session??, although I haven't successfully achieve this one yet.... which is painful as if my code doesn't work I know I can't get back in to run another test for a while.

    And finally is there a way to 'kill' sessions linked to a login user and product?

    Regards
  • harryknackers
    Junior Member
    • Jan 2013
    • 2

    #2
    Additionally, just tried a login which got a session key correctly... then successfully ran a List Events call, that returned all the events no problems... then did a logoff call using "https://identitysso.betfair.com/api/logout", which also reported a successful event... however I then exit my program, or go back to development mode, when I run app again, and login to Betfair, which will successfully return a Session Key... any further tasks I do, which are exactly the same as previous, it will always return INVALID_SESSION_INFORMATION. If I wait till tmrw... the process will work again.... but only for the first connection. Something appears to be locking within Betfair itself...

    Comment

    • ulnaoperating
      Junior Member
      • Apr 2024
      • 1

      #3
      Originally posted by harryknackers View Post
      Need some slight guidance, as this is kind off doing my head in...

      When I first do the login I get a JSON list of events as expected, and whilst I have that session open, I can continually use the List Events Call and I receive that data, remembering I am testing and debugging development.

      However, as soon as I exit my software, which releases my session variable, and I reload my test program and use the login process again, which gets another session key perfectly, then I try the same function to call the ListEventscall I receive a 'INVALID_SESSION_INFORMATION", and this doesn't clear for a while, I can turn computer off etc... basically anything, and the same Invalid Session Information appears (Login process appears fine though).
      gorilla tag

      zz0.mq74qubpf4izz
      Is this because the initial session key is still in the system, and basically locking any other requests until the original session times out??

      And what's the best practice process? Logout no matter what after each session??, although I haven't successfully achieve this one yet.... which is painful as if my code doesn't work I know I can't get back in to run another test for a while.

      And finally is there a way to 'kill' sessions linked to a login user and product?

      Regards
      It sounds like you're having trouble with Betfair's API. Even though you've successfully logged in, a new session key isn't being accepted once you exit and reload your software.

      The problem you're seeing might be because Betfair's API is refusing to accept new session keys until the current one expires, which means the first session key is still active in the system.​
      Last edited by ulnaoperating; 05-04-2024, 10:48 AM.

      Comment

      • NaomiFowler
        Junior Member
        • Nov 2024
        • 1

        #4
        Originally posted by harryknackers View Post
        Need some slight guidance, as this is kind off doing my head in...

        I am an older programmer, still using VB6, but ultimately ALL my software is VB6 and runs perfectly and I usually don't have an issue connecting to modern day systems.

        However, with Betfair I am encountering an issue, that is proving hard to debug.

        I have a login session using a MSXML2.XMLHTTP object to connect to https://identitysso.betfair.com.au/api/login

        This section works perfectly ALL the time, I receive a JSON response {'token";'[SESSION KEY]","product":"[PRODUCT KEY]",'status";"SUCCESS",'error":""}, so I get the session key..

        I then do a listeventscall to the URL https://api.betfair.com/json-rpc/ with a request string of "{""jsonrpc"": ""2.0"", ""method"": ""SportsAPING/v1.0/listEventTypes"", ""params"": {""filter"":{}}, ""id"": 1}"

        What is happening is: PowerPlay Casino

        When I first do the login I get a JSON list of events as expected, and whilst I have that session open, I can continually use the List Events Call and I receive that data, remembering I am testing and debugging development.

        However, as soon as I exit my software, which releases my session variable, and I reload my test program and use the login process again, which gets another session key perfectly, then I try the same function to call the ListEventscall I receive a 'INVALID_SESSION_INFORMATION", and this doesn't clear for a while, I can turn computer off etc... basically anything, and the same Invalid Session Information appears (Login process appears fine though).

        Is this because the initial session key is still in the system, and basically locking any other requests until the original session times out??

        And what's the best practice process? Logout no matter what after each session??, although I haven't successfully achieve this one yet.... which is painful as if my code doesn't work I know I can't get back in to run another test for a while.

        And finally is there a way to 'kill' sessions linked to a login user and product?

        Regards
        Betfair session tokens are single-user and single-login, so when your VB6 app exits without calling the logout endpoint, the session remains active on Betfair’s side. When you immediately log in again, Betfair sees the previous session still alive and returns INVALID_SESSION_INFORMATION. Best practice is to always send a logout request before closing the app—or reuse the existing session key until it naturally expires. If needed, Betfair support can also kill active sessions tied to your account.

        Comment

        Working...
        X