Andre0512 / Andre0512/hon

Authentication Error When Adding hOn Integration using a Google account that has 2FA turned on

Aberta
#159 5 comentários 0 reações 1 responsável Reivindicada por @Andre0512 Ver no GitHub
authentication error bug
Linguagem predominante
Python
Estrelas
1.5k
Forks
2.4k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I've previously been using the integration with a non-google account but needed to switch to using a google account. So I re-setup the hOn ios application and added the appliance without an issue - logging in using my google account. This all works fine.

Then I removed the hOn integration from HA, restarted it and then added the integration again. Entering google account and password - it adds the integration but then fails to login (logs below).

If I go to account2.hon-smarthome.com and login, it works ok but the initial login did require me to confirm a login on my phone (2FA).

If I use pyhOn to try and login from my HA host I get the same unable to login error.

Is there a way to get around this or do I have to revert back to a login without 2FA active on the google account?

Thanks, Lee

Logs:
```
2024-01-24 12:11:50.085 ERROR (MainThread) [pyhon.connection.auth] hOn Authentication Error
1 401 - https://account2.hon-smarthome.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source={redacted}&display=touch
2 302 - https://account2.hon-smarthome.com/s/login?display=touch&ec=302&inst=R2&startURL=/setup/secur/RemoteAccessAuthorizationPage.apexp?source%{redacted}3Dtouch
3 301 - https://account2.hon-smarthome.com/s/login/?display=touch&ec=302&inst=R2&startURL=/setup/secur/RemoteAccessAuthorizationPage.apexp?sourceRedacted3Dtouch
4 200 - https://account2.hon-smarthome.com/s/login/?language=en_US&display=touch&ec=302&inst=R2&startURL=%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource{redacted}26display%3Dtouch&System=IoT_Mobile_App&RegistrationSubChannel=hOn
5 200 - https://account2.hon-smarthome.com/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1
ERROR - 200 - https://account2.hon-smarthome.com/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1
=============== Response ===============
{"actions":[{"id":"79;a","state":"SUCCESS","returnValue":"Your login attempt has failed. Make sure the username and password are correct.","error":[]}],"context":{"mode":"PROD","app":"siteforce:loginApp2","contextPath":"/s/sfsites","pathPrefix":"","fwuid":"{redacted}","mlr":1,"loaded":{"APPLICATION@markup://siteforce:loginApp2":"{redacted}"},"globalValueProviders":[{"type":"$Global","values":{"eswConfigDeveloperName":{"writable":true,"defaultValue":""},"isVoiceOver":{"writable":true,"defaultValue":false},"setupAppContextId":{"writable":true,"defaultValue":""},"density":{"writable":true,"defaultValue":""},"srcdoc":{"writable":false,"defaultValue":false},"appContextId":{"writable":true,"defaultValue":""},"dynamicTypeSize":{"writable":true,"defaultValue":""}}}],"enableAccessChecks":true,"apce":1,"dns":"c","lairn":[],"laerc":[],"lav":"59","mna":{"lightning":"interop"},"lff":{"ENABLE_MIXED_SHADOW_MODE":false,"ENABLE_LEGACY_SCOPE_TOKENS":false,"DISABLE_LIGHT_DOM_UNSCOPED_CSS":false},"arse":1,"acaf":1,"services":["markup://lightning:configProvider","markup://force:salesforceScopedModuleResolver","markup://force:ldsEngineCreator","markup://instrumentation:locatorService"]},"perfSummary":{"version":"core","request":5,"actions":{"79;a":{"total":3,"db":1}},"actionsTotal":3,"overhead":0}}
========================================
2024-01-24 12:11:50.085 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry {redacted}@gmail.com for hon
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hon/__init__.py", line 32, in async_setup_entry
hon = await Hon(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/hon.py", line 66, in create
await self.setup()
File "/usr/local/lib/python3.11/site-packages/pyhon/hon.py", line 97, in setup
appliances = await self.api.load_appliances()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/api.py", line 77, in load_appliances
async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp:
File "/usr/local/lib/python3.11/contextlib.py", line 204, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/handler/base.py", line 64, in get
async with self._intercept(*args, **kwargs) as response:
File "/usr/local/lib/python3.11/contextlib.py", line 204, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/handler/hon.py", line 61, in _intercept
kwargs["headers"] = await self._check_headers(kwargs.get("headers", {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/handler/hon.py", line 51, in _check_headers
await self.auth.authenticate()
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 258, in authenticate
if not (url := await self._login()):
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 195, in _login
await self._error_logger(response)
File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 96, in _error_logger
raise exceptions.HonAuthenticationError("Can't login")
pyhon.exceptions.HonAuthenticationError: Can't login
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.