Authenticate on Stream API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • User9045
    Junior Member
    • May 2021
    • 1

    #1

    Authenticate on Stream API

    I'm working in Python.

    - First I login to 'https://identitysso.betfair.com/api/login' with app_key, username and password.
    - I save the toekn in the response and add it to my headers as 'X-Authentication'
    - I can now request event and market info.


    - I log in again to 'https://identitysso-cert.betfair.com/api/certlogin' with username password and cert files
    - I successfully log in and get the sessionToken then save it

    - I connect to the stream and receive this message:
    Code:
    b'{"op":"connection","connectionId":"103-240521122118-526731"}\r\n'
    - I send the following message:
    Code:
    b'{"op": "authentication", "id": 1, "appKey": REDACTED, "session": "Bearer sessionTokenFromEarlier"}\r\n'
    - I receive:
    Code:
    b'{"op":"status","id":1,"statusCode":"FAILURE","errorCode":"INVALID_SESSION_INFORMATION","errorMessage":"Bearer token / AppKey pair is invalid","connectionClosed":true,"connectionId":"103-240521122118-526731"}\r\n'

    Am I using the wrong session token here? I currently only want to receive market info
  • LiamP
    Junior Member
    • Oct 2015
    • 284

    #2
    Any reason you are not using betfairlightweight?

    https://github.com/liampauling/betfair

    I understand if you want to learn how to use it yourself but feel free to join the slack and we can probably help 😀

    Comment

    Working...
    X