Voyz / ibeam

IBeam is an authentication and maintenance tool used for the Interactive Brokers Client Portal Web API Gateway.
Apache License 2.0
583 stars 115 forks source link

2FA without google messages #37

Closed matandi1 closed 2 years ago

matandi1 commented 3 years ago

Hi all,

first of all thanks for the great package that ibeam provides! I have been working with my paper trading account without 2FA so far and now like to connect the live trading account with 2FA.

As I have no Android device the "Messages by Google" App is not available to me and I was wondering how to practically and simply do this in another way, setting it up via my mac / ios device?

I have seen the 2nd handler (HTTP) but not sure how I could practically use it.

Thank you in advance Matandi

Voyz commented 3 years ago

Hi @matandi1 welcome to IBeam πŸ‘‹ Thanks for outlining your problem with 2FA using Google Messages. Another way to approach 2FA was outlined in this comment: https://github.com/Voyz/ibeam/issues/8#issuecomment-763353923 You could set this up using the HTTP handler, calling your intermediate server that would access twillio and return the 2FA code. Hope this helps?

MaanasPeri23 commented 3 years ago

Hey @Voyz ! Thanks so much for providing the community with this package, but I had a quick question. After I've been having the same error as above (please also see below) I went through the threads you linked above, and it appears that you've updated the Ibeam repo voyz/ibeam:0.3.0-rc2 to take care of the 2FA handler? Is this the latest version? Because on my machine it shows that I have the latest version of voyz/ibeam, but yet I'm still getting the error.

Here is the error:

` 2021-11-02 06:29:29,141|I| ############ Starting IBeam version 0.3.0 ############ 2021-11-02 06:29:29,156|I| Gateway not found, starting new one... running
runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/* verticle : 2021-11-02 06:29:30,163|I| Gateway started with pid: 14 WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/srv/clientportal.gw/build/lib/runtime/netty-common-4.1.15.Final.jar) to constructor java.nio.DirectByteBuffer(long,int) WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release -> mount demo on /demo Java Version: 11.0.9.1


version: ed4af2592e9dd4a784d5403843bd18292fd441ea Fri, 9 Nov 2018 13:23:18 -0500


This is a Beta release of the Client Portal Gateway for any issues, please contact api@ibkr.com and include a copy of your logs


https://www.interactivebrokers.com/api/doc.html


Open https://localhost:5000 to login App demo is available after you login under: https://localhost:5000/demo/ 2021-11-02 06:29:36,493|I| No active sessions, logging in... 2021-11-02 06:29:48,419|I| Credentials correct, but Gateway requires two-factor authentication. 2021-11-02 06:29:48,420|I| No 2FA handler found. You may define your own 2FA handler or use built-in handlers. See documentation for more. 2021-11-02 06:29:48,420|W| No 2FA code returned. Aborting authentication. 2021-11-02 06:29:56,005|E| Error displayed by the login webpage: unknown 2021-11-02 06:30:02,757|I| Credentials correct, but Gateway requires two-factor authentication. 2021-11-02 06:30:02,758|I| No 2FA handler found. You may define your own 2FA handler or use built-in handlers. See documentation for more. 2021-11-02 06:30:02,759|W| No 2FA code returned. Aborting authentication. 2021-11-02 06:30:10,251|E| Error displayed by the login webpage: unknown 2021-11-02 06:30:17,179|I| Credentials correct, but Gateway requires two-factor authentication. 2021-11-02 06:30:17,180|I| No 2FA handler found. You may define your own 2FA handler or use built-in handlers. See documentation for more. 2021-11-02 06:30:17,180|W| No 2FA code returned. Aborting authentication. ^C^C2021-11-02 06:30:24,477|E| Error displayed by the login webpage: unknown ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C 2021-11-02 06:30:31,637|I| Credentials correct, but Gateway requires two-factor authentication. 2021-11-02 06:30:31,637|I| No 2FA handler found. You may define your own 2FA handler or use built-in handlers. See documentation for more. 2021-11-02 06:30:31,638|W| No 2FA code returned. Aborting authentication. 2021-11-02 06:30:39,010|E| Error encountered during authentication Traceback (most recent call last): File "/srv/ibeam/src/authenticate.py", line 198, in authenticate_gateway trigger_id = trigger.get_attribute('id') File "/opt/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 141, in get_attribute self, name) File "/opt/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/opt/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/opt/venv/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: headless chrome=89.0.4389.82)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/srv/ibeam/src/authenticate.py", line 254, in authenticate_gateway raise RuntimeError('Error encountered during authentication') from e RuntimeError: Error encountered during authentication 2021-11-02 06:30:39,195|I| Authentication process failed ` And how would I be able to use the HTTP Handler method if I can't get across the 2FA problem when I'm starting up the server? Do I have to use the Twilio method you mentioned or did I miss something you pointed out in those threads? Thank you for all your helpπŸ™ŒπŸ½

Update: I saw your comment from 7 days ago to "docker pull voyz/ibeam:0.4.0-rc2" but I still got the same error above

Voyz commented 3 years ago

Sorry @MaanasPeri23 could you rephrase your question? I'm not sure what you'd like me to address in your recent post, as you seemed to have keyboard-interrupted the process and as such errors seemed to have followed. Please use 0.4.0-rc2 for testing, 0.3.0-rc2 is an old release candidate that shouldn't be used now.

Using Twillio would be one way to overcome 2FA. Make sure you check our documentation on 2FA where we outline how IBeam handles it: https://github.com/Voyz/ibeam/wiki/Two-Factor-Authentication Keep in mind that at the time we don't provide any official solution or guide on how to solve Gateway's 2FA, but only means to achieve it - hence reading the post on Twillio in #8 would be a good place to start.

Voyz commented 2 years ago

Closing this issue due to lack of activity. Please feel free to reopen and continue the discussion if needed πŸ‘