How to persist the 2FA for weekly use? #313
Replies: 3 comments 7 replies
-
|
You cannot do 2FA persistence across a Sunday: it is IBKR's policy that there must be at least one full 2FA authentication each week: this is a hard-and-fast rule and there is no way around it. When TWS/Gateway do an auto-restart, the credentials established by 2FA are persisted temporarily in a file called But those credentials are invalidated by IBKR on Sunday at 01:00 US/Eastern (see https://www.ibkrguides.com/traderworkstation/auto-restart-considerations.htm). Thus the first start of TWS/Gateway during the week will always require 2FA. And therefore you will necessarily have to do a 2FA at least once a week. Note that if you leave TWS/Gateway running without restarting on Sunday, the next autorestart does actually succeed, but the following one will fail. I don't know why IBKR allow this - it should fail at the first auto-restart - but I wish they wouldn't because it causes confusion. If you close down TWS/Gateway during the week (for example by restarting your container), the |
Beta Was this translation helpful? Give feedback.
-
|
DId you read what I wrote? This is not possible. Reusing a previous session depends on the Shutting down your container is not an autorestart situation, so the Why start a new container for each trade? And if you really want to do that, why is tapping your phone to do the 2FA each time such a big deal? |
Beta Was this translation helpful? Give feedback.
-
|
@rlktradewright is right — IBKR requires a fresh 2FA each week and there's no persisting across it. But if the real pain is the manual phone approval, that part is avoidable: with the Mobile Authenticator (TOTP) method the weekly 2FA can run unattended — the code is computed and submitted automatically at (re)start, no tap. ibg-controller (https://github.com/code-hustler-ft3d/ibg-controller) does this on headless IB Gateway (set TWOFACTOR_CODE), and can seed Gateway's autorestart token via GATEWAY_WARM_STATE. It won't change the once-a-week rule, just removes the manual step. (Gateway only; IB Key push still needs a human.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone 👋
I'm using the Docker image and everything is working well — except for 2FA persistence.
Each week I want to restart the container without manually re-approving 2FA again on my phone.
I'm mounting volumes and using CUSTOM_CONFIG=yes as well, but still I get prompted again after restart.
I’m wondering:
What's the correct way to persist the 2FA token across container restarts?
Is there a specific file or volume that needs to be mounted to achieve that?
Is CUSTOM_CONFIG required for this, or can it work with the default image setup?
Thanks so much in advance 🙏
Any guidance or working examples would be really appreciated!
Beta Was this translation helpful? Give feedback.
All reactions