Error code 32099 INVALID_SESSION_INFORMATION

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • toneloc
    Junior Member
    • Mar 2021
    • 3

    #1

    Error code 32099 INVALID_SESSION_INFORMATION

    Trying to develop an app in Visual Studio, using James Butler's "PROGRAMMING FOR BETFAIR" book

    I think I've fallen at the first.

    Keep getting the following error code when trying to run the application:-

    [{"jsonrpc":"2.0","error":{"code":-32099,"message":"ANGX-0003","data":{"APINGException":{"requestUUID":"ie2-ang24b-prd-03031004-001105e8d2","errorCode":"INVALID_SESSION_INFORMATI ON","errorDetails":""},"exceptionname":"APINGExcep tion"}},"id":1}]

    I thought it might be an issue with ssoid but I have just output the ssoid to a form and used it in the visualiser and it works fine.

    I am using the delay APP KEY at the moment as only started experimenting so not sure if that is an issue?

    Any ideas please?
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    According to the documentation, "INVALID_SESSION_INFORMATION The session token hasn't been provided, is invalid or has expired. Login again to create a new session".

    If the problem persists, take any personal data out of the call that returned the problem and I'll check it over.

    Comment

    • toneloc
      Junior Member
      • Mar 2021
      • 3

      #3
      Thanks very much, jabe.

      Got 1 module :-
      Code:
      Imports System.Net
      Imports System.Text
      Imports System.IO
      Imports Newtonsoft.Json
      Module SportsAPI
      
      Public ssoid As String 'session token
      
      Private Function SendSportsReq(ByVal jsonString As String)
      Dim request As WebRequest =
      WebRequest.Create("https://api.betfair.com/exchange/betting/json-rpc/v1")
      
      Dim byteArray As Byte() = Encoding.UTF8.GetBytes(jsonString)
      
      request.Method = "POST"
      request.ContentType = "application/json"
      request.ContentLength = byteArray.Length
      request.Headers.Add("X-Application: XXX APP KEY GOES HERE XXX")
      request.Headers.Add("X-Authentication: & ssoid")
      
      Dim dataStream As Stream = request.GetRequestStream()
      dataStream.Write(byteArray, 0, byteArray.Length)
      
      Dim response As WebResponse = request.GetResponse()
      dataStream = response.GetResponseStream()
      
      Dim reader As New StreamReader(dataStream)
      Dim responseFromServer As String = reader.ReadToEnd()
      
      Form1.Print(responseFromServer)
      
      Return responseFromServer
      
      End Function


      LoginForm:-

      Code:
      Public Class LoginForm
      ' Private Sub LoginForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      
      ' End Sub
      
      Private ssoid As String
      Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As _
      WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
      
      Dim cookieArray As String() = WebBrowser1.Document.Cookie.Split(";")
      If WebBrowser1.Document.Cookie.Count > 0 Then
      
      For Each cookie In cookieArray
      Dim Idx As Long = cookie.IndexOf("=")
      If Idx <> -1 Then
      Dim cookieName As String = cookie.Substring(0, Idx).Trim
      Dim cookieValue As String = cookie.Substring(Idx + 1).Trim
      
      If cookieName = "ssoid" Then
      ssoid = cookieValue
      End If
      
      End If
      Next
      End If
      
      If Not ssoid = "" Then
      'Form1.Print(ssoid)
      SportsAPI.ssoid = ssoid 'copy ssoid to SportsAPI module
      Form1.Initialise()
      Me.Close()
      End If
      
      End Sub
      End Class
      Last edited by toneloc; 11-03-2021, 02:47 PM.

      Comment

      • geoffw123
        Senior Member
        • Mar 2014
        • 250

        #4
        Hi

        I am not a VB guy, but can see a mistake I think.

        Code:
        request.Headers.Add("X-Authentication: & ssoid")
        your quote mark " at the end is in the wrong place, it will treat ssoid as a literal string not a variable name

        Try
        Code:
        request.Headers.Add("X-Authentication: " & ssoid)
        hopre that helps

        Regards Geoff

        Comment

        • toneloc
          Junior Member
          • Mar 2021
          • 3

          #5
          Thanks very much, Geoff. That was it!

          Must have checked that code about 10 time as well!

          Comment

          Working...
          X