home-assistant/core

Unifi Integration needs higher timeout for logging in because of MFA

matze19999 opened this issue · 2 comments

The problem

Since MFA is needed on Unifi Accounts, we're unable to login with Home Assistant because the login process aborts with "Authentication failed" before I had a chance to accept the MFA message on Unifi Verify App.

What version of Home Assistant Core has the issue?

core-2024.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Network

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifi/

Diagnostics information

home-assistant_unifi_2024-05-16T07-48-07.105Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-05-16 09:47:56.241 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.1.3:8443/api/login) b'{"meta":{"rc":"error","msg":"api.err.Ubic2faTokenRequired"},"data":[{"default_mfa":"d30699d3-8f6c-42df-a0b8-1fd745fb5ae7","mfa_cookie":"fjIwMjIwNjA3fGVIN01JRGJBTGlQSzdGbDErQkJVOVh0ZEVjdkNEcTRNZjBoUFg5SSticlA2V0J3QWNQYkFwV0Q4R2J1YlBqbCt3UjdTR0RRVHJGa1NDOUtiQ2xhL2J0a0U0eVU4VkMzNmlHY0xUcDhPellkMHJvTmk1QkFyaFVCeElyejRsZ1R3bkNuOUZ4NDhXOTFxSk15d1pkRzREblh3cEVKdU9tMXQ2K3Fqd1hxcnczWWJoaHlFZEh4RHlXUkVmWDBtQjNnWEZhSG1KVHAvdnJnajhMdlk4M05zQnJXSGR1NXNWMXBzZHBxbmgzZVk4NGMzak9OSDloMFpYRTBMQTZmbDJDTVErY2NkdHl6NjU3NGMybGgvSDlpMGNqd0M3Myt0NWc9PXxkVFZkTmVFQWhmNjl1Nk9XdXUyRFJnZGY2ZVk9fFVzUEphTDIwSnZkeGZDK3NaVStKM0E9PXx0SXJtdWRwQUE0UURTdU1PeElFWU9XUzA1WjQ9","authenticators":[{"id":"2ec7d484-4cf5-48d1-96e6-ec4532d10592","type":"totp","status":"active","name":"Authenticator app"},{"id":"834150e0-4b42-4d82-bbc6-8aba9f933fb6","type":"email","status":"active","email":"pr\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7as@gmail.com"},{"id":"d30699d3-8f6c-42df-a0b8-1fd745fb5ae7","type":"push","status":"active","name":"proell.matthias@gmail.com"}]}]}'
2024-05-16 09:47:56.241 ERROR (MainThread) [aiounifi.interfaces.connectivity] Login failed '{'meta': {'rc': 'error', 'msg': 'api.err.Ubic2faTokenRequired'}, 'data': [{'default_mfa': 'd30699d3-8f6c-42df-a0b8-1fd745fb5ae7', 'mfa_cookie': 'fjIwMjIwNjA3fGVIN01JRGJBTGlQSzdGbDErQkJVOVh0ZEVjdkNEcTRNZjBoUFg5SSticlA2V0J3QWNQYkFwV0Q4R2J1YlBqbCt3UjdTR0RRVHJGa1NDOUtiQ2xhL2J0a0U0eVU4VkMzNmlHY0xUcDhPellkMHJvTmk1QkFyaFVCeElyejRsZ1R3bkNuOUZ4NDhXOTFxSk15d1pkRzREblh3cEVKdU9tMXQ2K3Fqd1hxcnczWWJoaHlFZEh4RHlXUkVmWDBtQjNnWEZhSG1KVHAvdnJnajhMdlk4M05zQnJXSGR1NXNWMXBzZHBxbmgzZVk4NGMzak9OSDloMFpYRTBMQTZmbDJDTVErY2NkdHl6NjU3NGMybGgvSDlpMGNqd0M3Myt0NWc9PXxkVFZkTmVFQWhmNjl1Nk9XdXUyRFJnZGY2ZVk9fFVzUEphTDIwSnZkeGZDK3NaVStKM0E9PXx0SXJtdWRwQUE0UURTdU1PeElFWU9XUzA1WjQ9', 'authenticators': [{'id': '2ec7d484-4cf5-48d1-96e6-ec4532d10592', 'type': 'totp', 'status': 'active', 'name': 'Authenticator app'}, {'id': '834150e0-4b42-4d82-bbc6-8aba9f933fb6', 'type': 'email', 'status': 'active', 'email': 'pr···········as@gmail.com'}, {'id': 'd30699d3-8f6c-42df-a0b8-1fd745fb5ae7', 'type': 'push', 'status': 'active', 'name': 'proell.matthias@gmail.com'}]}]}'
2024-05-16 09:47:56.241 ERROR (MainThread) [homeassistant.components.unifi] Unknown UniFi Network communication error occurred: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/unifi/hub/api.py", line 58, in get_unifi_api
    await api.login()
  File "/usr/local/lib/python3.12/site-packages/aiounifi/controller.py", line 61, in login
    await self.connectivity.login()
  File "/usr/local/lib/python3.12/site-packages/aiounifi/interfaces/connectivity.py", line 75, in login
    raise ERRORS.get(data["meta"]["msg"], AiounifiException)
aiounifi.errors.TwoFaTokenRequired

Additional information

No response

Hey there @Kane610, mind taking a look at this issue as it has been labeled with an integration (unifi) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of unifi can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign unifi Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


unifi documentation
unifi source
(message by IssueLinks)

Hello. That is for cloud accounts. Local accounts will still be allowed without MFA.

See https://community.home-assistant.io/t/ubiquiti-unifi-network-add-on-integration/678411/17?u=robban