Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid 2FA code. #2568

Open
pro2call-nl opened this issue Sep 30, 2024 · 7 comments
Open

Invalid 2FA code. #2568

pro2call-nl opened this issue Sep 30, 2024 · 7 comments

Comments

@pro2call-nl
Copy link

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

When setting up the app i enter amazon.nl username password and 2fa. then i get the message invalid 2fa code

To Reproduce

setup

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots

System details

  • Home Assistant version: 9.3
  • alexa_media version (from const.py or HA startup log): 4.13.2
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log): unknow as it has not setup.
  • Is Amazon 2FA/2SV enabled <!---We will not debug login issues if unanswered---> (y/n): YES
  • Amazon Domain: amazon.nl

Debug Logs (alexa_media & alexapy)
Please provide logs.

Additional context

Logger: alexapy.alexalogin
Bron: custom_components/alexa_media/config_flow.py:278
integratie: Alexa Media Player (documentatie, problemen)
Eerst voorgekomen: 20:39:15 (4 gebeurtenissen)
Laatst gelogd: 20:42:17

Error creating TOTP; ****** likely invalid

@compujunk
Copy link

have the same problem

@Rezessivo
Copy link

same here....

@pro2call-nl
Copy link
Author

pro2call-nl commented Oct 6, 2024

i found some extra logging.

Logger: homeassistant.util.loop
Bron: util/loop.py:136
Eerst voorgekomen: 18:54:33 (2 gebeurtenissen)
Laatst gelogd: 18:59:09

Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7fb51c65d7d0>, <Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>) inside the event loop by custom integration 'dahua' at custom_components/dahua/__init__.py, line 105: ssl_context = ssl.create_default_context() (offender: /usr/local/lib/python3.12/ssl.py, line 713: context.load_default_certs(purpose)), please create a bug report at https://github.com/rroller/dahua/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 461, in _async_setup_component await asyncio.gather( File "/usr/src/homeassistant/homeassistant/setup.py", line 463, in <genexpr> create_eager_task( File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 742, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/dahua/__init__.py", line 71, in async_setup_entry coordinator = DahuaDataUpdateCoordinator(hass, events=events, address=address, port=port, rtsp_port=rtsp_port, File "/config/custom_components/dahua/__init__.py", line 105, in __init__ ssl_context = ssl.create_default_context()
Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7fb4fb6c65d0>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/config_flow.py, line 280: self.login = AlexaLogin( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/alandtse/alexa_media_player/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 556, in start task = asyncio.Task(coro, loop=loop, eager_start=True) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle return await handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin return await func(self, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper return await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 370, in async_configure result = await self._async_configure(flow_id, user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 417, in _async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 520, in _async_handle_step result: _FlowResultT = await getattr(flow, method)(user_input) File "/config/custom_components/alexa_media/config_flow.py", line 280, in async_step_user self.login = AlexaLogin(

@jaimemiguel
Copy link

i have the same issue!

@drifter213
Copy link

I have the same issue using amazon.de

@drifter213
Copy link

I found a solution!
Just leave the 2fa field empty, you will get redirected to a login form, then the setup finishes.

@danielbrunt57
Copy link
Collaborator

i found some extra logging.

Logger: homeassistant.util.loop
Bron: util/loop.py:136
Eerst voorgekomen: 18:54:33 (2 gebeurtenissen)
Laatst gelogd: 18:59:09

Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7fb51c65d7d0>, <Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>) inside the event loop by custom integration 'dahua' at custom_components/dahua/__init__.py, line 105: ssl_context = ssl.create_default_context() (offender: /usr/local/lib/python3.12/ssl.py, line 713: context.load_default_certs(purpose)), please create a bug report at https://github.com/rroller/dahua/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs

Those are WARNINGS only. The blocking calls have always existed. They only block the event loop for the duration of the call (fractions of a second). HA is just getting more astute in detecting them and issuing a warning as they are trying to get the event loop to be as efficient as possible and just acknowledge a call, process it quickly and move on to the next call. Operations like reading or writing storage take much longer and they want operations like that performed asynchronously or offloaded it to an executor loop. Python libraries like https were coded way back when to do things synchronously so ultimately they need to be rewritten for HA to be happy. They however are external common python libraries and not something HA has a lot of influence on or can change. HA has no choice but to use them as-is and the coder has to figure out how to circumvent their behaviour. I've eliminated 2 other load_default_certs with args ssl.SSLContext warnings as well as the one regarding cookie i/o but this remaining one has me stumped...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants