¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: IBC 3.17.0 not using SecondFactorAuthenticationTimeout setting


 

Jasmin

If you look at the list of I00BC Settings in the logfile, you'll see:

SecondFactorAuthenticationExitInterval=
SecondFactorAuthenticationTimeout=180

When you do second factor authentication, IBKR gives you 180 seconds to acknowledge the prompt in the IBKR Mobile app. That's how long TWS/Gateway displays the Second Factor Authentication dialog, after which the basic login dialog is displayed. IBC needs to know the length of this interval, and SecondFactorAuthenticationTimeout specifies what it is. The only reason to ever change that setting is if IBKR decide to use a longer or shorter interval for some reason: and in the several years since 2FA was introduced, this hasn't changed. If that interval elapses and you haven't acknowledged the 2FA prompt, IBC restarts the login sequence, and you then get another chance to complete the 2FA (provided you have ReloginAfterSecondFactorAuthenticationTimeout=yes). This will repeat forever until the user finally acknowledges the prompt. So if you're in the bath or asleep in a hotel room on the other side of the world, you don't need to worry about catching the prompt the first time it's displayed.

Increasing the value of SecondFactorAuthenticationTimeout from its default of 180 seconds will just increase the time till you get another prompt after missing. Decreasing it is will probably cause problems in some cases, though if you successfully deal with the prompt quickly it will all work ok. So, please don't ever change SecondFactorAuthenticationTimeout unless it's clear that IBKR have changed the 2FA timeout.

The thing to note is that SecondFactorAuthenticationTimeout has nothing to do with the 'If login has not completed, IBC will exit in 60 seconds' message. This occurs when the 2FA prompt has been acknowledged, and the Second Factor Authentication dialog has been closed by TWS/Gateway. Normally login should now complete in a couple of seconds. But experience has shown that there are rare circumstances where this doesn't happen, and TWS/Gateway just hangs. After a period of time specified in SecondFactorAuthenticationExitInterval, if login hasn't completed, IBC shuts down TWS/Gateway, on the assumption that something is significantly wrong. The start scripts contain a setting that governs whether the script will automatically restart IBC, in the hope that doing so will clear the condition causing the problem.

So it seems that you need to change the SecondFactorAuthenticationExitInterval setting rather than SecondFactorAuthenticationTimeout.

In the scenario you describe, where you have a lower-powered CPU, the best thing to do is to not start all the TWS instances at the same time. Just give each one a minute or two to get going before starting the next. Then maybe there won't be any need to change SecondFactorAuthenticationExitInterval.

Richard

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jasmin J.
Sent: Thursday, August 15, 2024 12:12 AM
To: [email protected]
Subject: [ibc] IBC 3.17.0 not using SecondFactorAuthenticationTimeout setting

Hello Richard!

First I want to thank you for your excellent working IBC program!


Now my problem:

I have configured "SecondFactorAuthenticationTimeout=180", but in the log IBC says "If login has not completed, IBC will exit in 60 seconds".

Why I am setting this long timeout:
On my server I am starting several TWS instances and I do not have so much CPU power. So when they starting up all at once I see 100% CPU load which extends the startup time a lot.

I found that IBC was complaining that the 2FA didn't finish in time so I increased the timeout to 3 Minutes which is really enough to startup all TWS instances. At least to do the login. I immediately accepted the 2FA requests when they popped up on the phones. So the 2Fa for all accounts was finished within 20..30 seconds after startup.

For me it seems the setting is not used by IBC as the default of 60 Seconds is still used instead of the 180.

PLS can you check if I am right or advice me which settings I need to modify to get a 3 minute timeout used by IBC.

BR,
Jasmin

PS: I attached the Logfile if you want to check it on your own.

Join [email protected] to automatically receive all group messages.