Non Interactive Login is baffling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #1

    Non Interactive Login is baffling

    Hi

    I am looking into switching my App. over from an interactive login to non interactive login using a Certificate

    I downloaded the Betfair sample C# code https://github.com/betfair/API-NG-sa...ractive-cSharp

    I have zero experience in this area, so bear with me for some dumb questions. The Betfair developer docs page doesnt help as its close to incomprehensible.

    I have created a *.crt file and uploaded it to my Betfair account. It swallowed it ok, but no idea if I created correctly or not.
    I have created a * pem file and a *.p12 file, havent the foggiest if they are correct or not.

    Q1) When i create *.crt,*.pem,*p12 files, I dont think I need to embed my personal Betfair username and Betfair password into them ? I was bit unclear on this.

    Q2) When I run the Betfair non interactive sample code, I have to input, my Appkey, my Betfair username/password and path to p12 file. I think I am totally missing the point here but I thought the whole point of a non interactive login is that i dont need to enter username and password ?

    i mean I could get my existing code to login non interactively by just saving username and password to disk and reading it at login time (Yes I know that is against the Betfair rules).

    If for the non interactive login I have to hardcode into my App my username and password (or type it in manually on login) whats the point ?

    Can someone give me an overview of how this non interactive login is meant to work ?

    Q3 When I run the sample non interactive code I get the response "loginStatus":"CERT_AUTH_REQUIRED". This means either my certs arent found or arent correct. Any clues on how I go about debugging this ? Not sure where to begin even.


    Note For Betfair:

    To even get to this point I had to waste several hours figuring out why your sample code doesnt even work on a bog standard Win10 install here. It receives no valid response back from the Server

    The error message you get is really helpful, it says "An error occurred"

    I tracked the problem down to an incompatible TLS version.

    To fix it I had to add this line to the function initHttpClientInstance()

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;


    It can now communicate, but gets the CERT_AUTH_REQUIRED error


    !!!! BEFAIR PLEASE FIX YOUR SAMPLE CODE, ITS VERY FRUSTRATING WHEN SAMPLE CODE DONT WORK !!!!

    Thanks for any help on this

    Geoff
    Last edited by geoffw123; 12-04-2020, 09:16 PM.
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    Have you searched the rest of the forum? Someone else might have had a similar problem.

    Comment

    • geoffw123
      Senior Member
      • Mar 2014
      • 250

      #3
      Hi Jabe

      Yes I searched first, nothing of any help.

      I was hoping it was an easy question for someone to explain the general principle of the non interactive login. As in the fact Betfairs sample code requires you to enter your username and password, so naively to me it seems just the same as the interactive login. I must be missing something very obvious here.

      Betfairs documentation in this area is hopeless, no overview of the principle anywhere on their website that I could find. Their sample code doesnt have any notes expaining anything. They have an entire C# module in their sample project that is not even used anywhere and no notes why its there at all. Their sample code doesnt work out of the box. etc etc. A multi million pound company should really do better than that.

      Geoff

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        I've decided to start learning C# (I had intended to after completing my main Betfair/API prog, but haven't got that wrapped up yet, and might just rewrite the whole thing in C#). I might make the non-interactive log in one of the first things I try. It may be a few weeks or more before I get round to it, but I'll see about noting all the problems I encounter on the way.

        The interactive version confused me. I took it from another website but was confused because for some reason it goes through the code twice, and I had to add a bodge for it to ignore a particular condition on its first pass.

        Comment

        • geoffw123
          Senior Member
          • Mar 2014
          • 250

          #5
          Hiya Jabe

          C# is a very nice language and pretty easy to learn. The Dot Net and the "Betfair'y" stuff is the trickier part.

          I have got rid of the CERT_AUTH_REQUIRED error. The irritating part is I have no idea what fixed it. All as I did was delete the *.crt certifcate file I uploaded to the Betfair website and then re-uploaded the same exact file. From then on it seems to work and give me a session token back.

          I am still unclear on the general overview of whats the point of this, if I have to manually enter or hardcode username/password into their sample code.

          Looks like not many folks understand the bigger picture here, as tthis thread isnt getting many replies.

          Comment

          • jabe
            Senior Member
            • Dec 2014
            • 705

            #6
            Morning!

            I've picked up some experience of the Betfair and Dot Net stuff while I was writing the prog in VB.NET, but the async stuff has made my head spin! I noticed recently that Microsoft have no intention of developing the VB.NET any further, and I was hoping C# might be easier and better for the async stuff. Inevitably with most programs there's always that feeling - after spending ages working on it - that, with hindsight, it might have been better to do a few things differently.

            Have you considered encypting your userid and password and saving them in a file that your program can extract them from? At least it would mean that you're not leaving a readable version lying around anywhere. If you're feeling particularly paranoid, you could hide the encrypted version in a photo file, for instance.

            Glad to hear you've managed to log in!

            Comment

            • geoffw123
              Senior Member
              • Mar 2014
              • 250

              #7
              Hiya

              Yes Async/Await stuff is a bit magic and baffling at first. This guy is very good at explaining stuff see. https://www.youtube.com/watch?v=0qiB3oW_nd8 It might be more detail than you want though.

              Betfair's rules are pretty strict on what you can do for an interactive login. You can store the username to disk as long as its AES128 encrypted at least.
              You cannot also store the password even if it is encrypted. So I have done that I just store the encrypted username for my interactive login.

              yeah its a bit ironic, I have got the code working without understanding the wider picture and the purpose of it.

              Comment

              • jabe
                Senior Member
                • Dec 2014
                • 705

                #8
                Cheers, I'll take a look at the video.It's such a long time since I did most of the coding that I can't remember how I did the async stuff. There'll be a test program lying around somewhere, so that'll help remind me.

                It's sounding like the non-interactive login isn't worth my time if I'm still going to have to put the log in details in for each run.

                Comment

                Working...
                X