home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.93k stars 30.15k forks source link

iCloud sync Authentication required for Account #119595

Open PaulCavill opened 3 months ago

PaulCavill commented 3 months ago

The problem

A few hours after reconfiguring, the integration stops connecting to Apple and spams the log file with errors.

Steps to Reset:

Note: The reconfiguration encounters errors after submitting the one-time code. Reloading the Integration resolves the issue temporarily, allowing it to work again for a few hours.

What version of Home Assistant Core has the issue?

core-2024.6.2

What was the last working version of Home Assistant Core?

core-2024.5.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Apple iCloud

Link to integration documentation on our website

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

Diagnostics information

2024-06-13 20:48:45.387 ERROR (SyncWorker_63) [pyicloud.base] Authentication required for Account. (450) 2024-06-13 20:48:45.387 ERROR (SyncWorker_63) [homeassistant.components.icloud.account] Unknown iCloud error: Authentication required for Account. (450) 2024-06-13 20:50:48.442 ERROR (SyncWorker_35) [pyicloud.base] Authentication required for Account. (421) 2024-06-13 20:50:48.698 ERROR (SyncWorker_35) [pyicloud.base] Authentication required for Account. (450) 2024-06-13 20:50:48.698 ERROR (SyncWorker_35) [homeassistant.components.icloud.account] Unknown iCloud error: Authentication required for Account. (450) 2024-06-13 20:52:52.782 ERROR (SyncWorker_61) [pyicloud.base] Authentication required for Account. (421) 2024-06-13 20:52:53.039 ERROR (SyncWorker_61) [pyicloud.base] Authentication required for Account. (450)

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-06-13 21:15:32.849 DEBUG (SyncWorker_25) [pyicloud.base] Checking session token validity
2024-06-13 21:15:32.849 DEBUG (SyncWorker_25) [pyicloud.base] Checking session token validity
2024-06-13 21:15:32.852 DEBUG (SyncWorker_25) [pyicloud.base.http] POST https://setup.icloud.com/setup/ws/1/validate null
2024-06-13 21:15:34.161 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:34.165 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:34.166 DEBUG (SyncWorker_25) [pyicloud.base.http] {REDACTED json}
2024-06-13 21:15:34.167 DEBUG (SyncWorker_25) [pyicloud.base] Session token is still valid
2024-06-13 21:15:34.167 DEBUG (SyncWorker_25) [pyicloud.base] Authentication completed successfully
2024-06-13 21:15:34.173 DEBUG (SyncWorker_25) [pyicloud.services.findmyiphone.http] POST https://p144-fmipweb.icloud.com:443/fmipservice/client/web/refreshClient {REDACTED json}
2024-06-13 21:15:34.748 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:34.752 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:34.752 DEBUG (SyncWorker_25) [pyicloud.base] Re-authenticating Find My iPhone service
2024-06-13 21:15:34.752 DEBUG (SyncWorker_25) [pyicloud.base] Authenticating as paul.cavill@me.com
2024-06-13 21:15:34.759 DEBUG (SyncWorker_25) [pyicloud.base.http] POST https://idmsa.apple.com/appleauth/auth/signin {REDACTED json}
2024-06-13 21:15:36.468 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:36.472 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:36.477 DEBUG (SyncWorker_25) [pyicloud.base.http] POST https://setup.icloud.com/setup/ws/1/accountLogin {REDACTED json}
2024-06-13 21:15:36.831 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:36.834 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:36.834 DEBUG (SyncWorker_25) [pyicloud.base.http] Misdirected Request (421). Retrying ...
2024-06-13 21:15:37.185 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:37.187 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:37.187 ERROR (SyncWorker_25) [pyicloud.base] Authentication required for Account. (421)
2024-06-13 21:15:37.187 DEBUG (SyncWorker_25) [pyicloud.services.findmyiphone.http]  (450). Retrying ...
2024-06-13 21:15:37.437 DEBUG (SyncWorker_25) [pyicloud.base] Saved session data to file
2024-06-13 21:15:37.440 DEBUG (SyncWorker_25) [pyicloud.base] Cookies saved to /config/.storage/icloud/REDACTEDmecom
2024-06-13 21:15:37.440 ERROR (SyncWorker_25) [pyicloud.base] Authentication required for Account. (450)
2024-06-13 21:15:37.441 ERROR (SyncWorker_25) [homeassistant.components.icloud.account] Unknown iCloud error: Authentication required for Account. (450)

2024-06-13 21:26:11.514 ERROR (MainThread) [frontend.js.latest.202406100] Failed to format translation for key 'component.icloud.config.step.reauth_confirm.title' in language 'en'. Error: The intl string context variable "name" was not provided to the string "Authentication expired for {name}"

2024-06-13 21:27:49.633 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry REDACTED@me.com for icloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/icloud/__init__.py", line 102, in async_setup_entry
    await hass.async_add_executor_job(account.setup)
asyncio.exceptions.CancelledError
2024-06-13 21:27:50.019 DEBUG (SyncWorker_2) [pyicloud.base] Saved session data to file

Additional information

No response

home-assistant[bot] commented 3 months ago

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

Code owner commands Code owners of `icloud` 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 icloud` 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)


icloud documentation icloud source (message by IssueLinks)

Aviv943 commented 1 month ago

Having the save issue. My current version is core-2024.7.3

PaulCavill commented 1 month ago

Integration is still prompting for verification code when "app-specific password" is used but does not send code requests to iDevice. And does not reconfigure.

Core 2024.7.4 Supervisor 2024.08.0