ibeam icon indicating copy to clipboard operation
ibeam copied to clipboard

failed to login with 2 factor authentication

Open joachimtheca opened this issue 1 year ago • 3 comments

It seems like IB has changed login and require you to authenticate with 2 factor auth. Is there a way to handle this with iBeam currently? Can you use a certificate?

I am using rc3 version

9 08:08:26,539|E| Timeout reached when waiting for authentication. The website seems to not be loaded correctly. Consider increasing IBEAM_PAGE_LOAD_TIMEOUT. Website URL: https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on

Exception: File "/srv/ibeam/ibeam_starter.py", line 172, in success, shutdown, status = client.start_and_authenticate() File "/srv/ibeam/src/gateway_client.py", line 62, in start_and_authenticate success, shutdown, status = self.strategy_handler.try_authenticating(request_retries=request_retries) File "/srv/ibeam/src/handlers/strategy_handler.py", line 85, in try_authenticating return self._authentication_strategy_B(status, request_retries) File "/srv/ibeam/src/handlers/strategy_handler.py", line 140, in _authentication_strategy_B return self._log_in(status) File "/srv/ibeam/src/handlers/strategy_handler.py", line 151, in _log_in success, shutdown = self.login_handler.login() File "/srv/ibeam/src/handlers/login_handler.py", line 466, in login self.handle_timeout_exception(e, targets, driver, website_version, self.route_auth, self.base_url, self.outputs_dir) File "/srv/ibeam/src/handlers/login_handler.py", line 447, in login self.attempt(targets, wait_and_identify_trigger, driver) File "/srv/ibeam/src/handlers/login_handler.py", line 371, in attempt trigger, target = self.step_login(targets, wait_and_identify_trigger, driver, self.secrets_handler.account, self.secrets_handler.password, self.secrets_handler.key, self.presubmit_buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/ibeam/src/handlers/login_handler.py", line 188, in step_login trigger, target = wait_and_identify_trigger( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/ibeam/src/handlers/login_handler.py", line 67, in _wait_and_identify_trigger trigger = WebDriverWait(driver, timeout).until(any_of(*expected_conditions)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 95, in until raise TimeoutException(message, screen, stacktrace)

<class 'selenium.common.exceptions.TimeoutException'> Message:

2024-07-09 08:08:26,540|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fd7a9034110> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="44d0256013bf1f9cc428a2af416f8ddc")> 2024-07-09 08:08:26,554|I| Logging in failed 2024-07-09 08:08:26,556|I| Starting maintenance with interval 60 seconds

joachimtheca avatar Jul 09 '24 08:07 joachimtheca

Found a way to do authentication with the app. Though extremely cumbersome. But I guess this is a limitation of IB?

joachimtheca avatar Jul 09 '24 08:07 joachimtheca

And just like that data started coming in. Just noting that this was a timeout and not a 429.

exallon72 avatar Jul 09 '24 14:07 exallon72

Hey @joachimtheca unfortunately that is the limitation of IBKR at the moment. When you sign up with them you can opt for SMS authentication (although it is currently being deprecated from what I've learned), and use methods described in WiKi to automate it: https://github.com/Voyz/ibeam/wiki/Two-Factor-Authentication

Other than that, if you're an institution you can opt for OAuth. Alternatively, wait for the new 'WebApi' to be released, which should circumvent this issue altogether.

Voyz avatar Jul 17 '24 03:07 Voyz

I'm going to close this issue due to inactivity. Thanks for your contribution and please feel free to request a reopen if you'd like to continue the discussion 👍

Voyz avatar Oct 30 '24 12:10 Voyz