STRONG AUTH CODE required, betfair lightweight

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tom
    Junior Member
    • Jan 2019
    • 1

    #1

    STRONG AUTH CODE required, betfair lightweight

    I have (long had) 2FA enabled on my Betfair account. For a long time I was able to connect using API fine with this Python code ...

    tfa = '123456' #(whatever code on my Google Authenticator)
    trading = betfairlightweight.APIClient(username='my_username ', password='my_password{}'.format(tfa), app_key='my_app_key')
    trading.login_interactive()

    But now I get an error?

    LoginError: API login: STRONG_AUTH_CODE_REQUIRED

    Any clues?

    Thanks a lot

    Tom​
    Last edited by tom; 19-08-2024, 01:25 PM.
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    A bit of a shot in the dark - I've had a quick read up on 2FA and can see what you're doing. It looks in order, but I'm wondering what format(tfa) does. I think you need to set tfa up as a string and just add the string to your password. I'm concerned that format() might be doing some kind of numerical formatting, such as removing leading zeroes. Make tfa a string and lose the format function.

    Let us know if it works.

    Comment

    • jabe
      Senior Member
      • Dec 2014
      • 705

      #3
      Okay, I checked to see what format() does. So now I need to ask a couple of things. Is this exactly as you coded it and my_password and my_username are actual variables? I don't see why they need to be in quotes (as I say, I don't know Python). Are variables in quotes evaluated? Is it possible to just use

      password='{0}{1}'.format(my_password,tfa)

      instead?

      There should be a way to display the result of 'my_password{}'.format(tfa), which is evidently where the problem lies. Just assign that to a string and display it and then use the string in the call to betfairlightweight.APIClient instead. At least that way you get to see if it's your password with the 2FA code bunged on the end of it.
      Last edited by jabe; 20-08-2024, 10:21 PM.

      Comment

      Working...
      X