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

Apple iCloud app password doesn't work #57645

Open
kaczkalolo opened this issue Oct 14, 2021 · 50 comments
Open

Apple iCloud app password doesn't work #57645

kaczkalolo opened this issue Oct 14, 2021 · 50 comments
Assignees

Comments

@kaczkalolo
Copy link

The problem

When i try to setup icloud integration using APP SPECIFIC PASSWORD it just will not log me in. Using regular credentials and 2fa does log in but with that i'm getting emails from apple about logging in to my account...

What is version of Home Assistant Core has the issue?

core-2021.9.6

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

No response

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@probot-home-assistant
Copy link

icloud documentation
icloud source
(message by IssueLinks)

@probot-home-assistant
Copy link

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!
(message by CodeOwnersMention)

@FabioEight
Copy link

Same issue detected:

`Logger: homeassistant.components.icloud.config_flow
Source: components/icloud/config_flow.py:122
Integration: Apple iCloud (documentation, issues)
First occurred: 15:50:23 (4 occurrences)
Last logged: 16:02:32

Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))`

@tismofied
Copy link

I started having this issue as well. If I use app password I get " unknown error occurred" but if I use my icloud account password it works fine

@kaczkalolo
Copy link
Author

kaczkalolo commented Oct 21, 2021 via email

@rasmusbe
Copy link
Contributor

rasmusbe commented Nov 2, 2021

Same problem here

2021-11-02 20:42:33 ERROR (MainThread) [homeassistant.components.icloud.config_flow] Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Authentication required for Account. (421)'))

@deltazerorsan
Copy link

Yea, same here with two different Apple accounts. Both works with the account password but not with the APP SPECIFIC PASSWORD.

Rom

@Shadewing666
Copy link

Slightly different problem from what this seems to be but I'm not sure if I should open a new issue.

When I use an App Specific Password during the add integration process, it asks for an "iCloud verification code", i.e. 2-factor authentication. But since I'm using an App Specific Password, the iCloud 2FA does not trigger.

@bastianlemke
Copy link

Same problem here ...
I think this is a duplicate of #54473

@chrismanivong
Copy link
Contributor

I think this is more a feature request, as the app-specific-password isn't implemented in this integration.
In the app-specific password approach you need to name the application during technical logon together with your iCloud-username and the specific password. This integration is now working this way a.f.a.i.k. But It should do, to avoid problems with Apple on logging in as a non-human process.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 24, 2022
@rasmusbe
Copy link
Contributor

Still an issue

@chrismanivong
Copy link
Contributor

As underlying pyicloud uses just icloud web API, app specific passwords won't work. I investigated the documentation of pyicloud and for the time being, there is no possibility to get this working.
I still had not found documentation of Apple about the authentication and logon method of app-specific passwords. Once I get ahead, I would be able to add this functionality to pyicloud and in that case to iCloud integration on Home Assistant.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 27, 2022
@linust
Copy link

linust commented Jun 28, 2022

I can confirm that the issue is still there in the latest HA release

@github-actions github-actions bot removed the stale label Jun 28, 2022
@GoState
Copy link

GoState commented Jul 12, 2022

I still cant use App Specific passwords either. Here is documentation from apple on how 3rd party apps should use this feature... really this integrations should NOT allow you to use your normal credentials and 2FA but the app specific password ( https://support.apple.com/en-us/HT204397 ). Using the app specific password keeps you from getting those emails from apple too (I use this approach with another add-on and never have the email issues).

Please fix this its been going on for a very long time.

@icemanxbe
Copy link

Still an issue.

Please update the integration to support app specific passwords.

@maxshcherbina
Copy link
Contributor

Someone mentioned up top that app passwords cant work with the current integration, that's too bad - the documentation should reflect this.

@jbmanwell
Copy link

Still a problem. Bummer. Seems like a very important feature in terms of security

@a1466d44-d3dc-4c0b-90c7-315b088731d7

I'm only here to comment that I also just encountered this issue...
If there is a way to help as a non python dev let me know

@polskikrol
Copy link

I have the same issue. One person suggested going through with full MFA w/ account password and then swapping out the password with the app password once the entities are setup via the config file at .storage/core.config_entries. However, this does not work. Once the session cookie times out, which btw is valid and survives a service restart of HA, then we are back to being unable to auth with an error:
` Logger: pyicloud.base
Source: components/icloud/account.py:137
First occurred: 9:32:12 AM (2 occurrences)
Last logged: 9:32:12 AM

Authentication required for Account. (421)
Authentication required for Account. (450)

`
Other integrations support app passwords, and this should be the standard in terms of security.

@bcutter
Copy link

bcutter commented Mar 30, 2023

So what are chances this behavior will actually change?

@dlasher
Copy link

dlasher commented Sep 22, 2023

.... It's just unusable (to me) and I personally consider this a non-stable integration as it comes with more negative side effects than actual benefits....

I would tend to agree for the following reasons:

  1. Failure is silent. You stop getting updates to locations without ANY indication. "It's 3am, they are NOT still at work!"
  2. continual re-auth required (lack of app password support)

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@dlasher
Copy link

dlasher commented Dec 21, 2023

Superceded by : https://github.com/gcobb321/icloud3_v3

@maxshcherbina
Copy link
Contributor

Yes and no. I am not interested in the advanced functionality that icloud3v3 provides - I would like this to keep working. I think its mostly working now, I still need to re-authenticate every once in a while and I wish there was a more direct way to do this - each time I do it, its a little bit of a guessing game - did it work? Will I need to enter my code this time? etc.

@github-actions github-actions bot removed the stale label Dec 21, 2023
@lor74
Copy link

lor74 commented Jan 6, 2024

Yes and no. I am not interested in the advanced functionality that icloud3v3 provides - I would like this to keep working. I think its mostly working now, I still need to re-authenticate every once in a while and I wish there was a more direct way to do this - each time I do it, its a little bit of a guessing game - did it work? Will I need to enter my code this time? etc.

I agree. Moreover the configuration of iCloudV3 is not so obvious.... a lot of parameters etc...
Until last week I have used life360 integration, that probabily will never woks again, so now I have started to use this integration... at the beginning all works fine, and I was also able to get the app sepcific password working for a while.
Now the specific password is not working and moreover even if the integration is started I got a lot of error messages

2024-01-06 12:12:11.467 ERROR (SyncWorker_0) [pyicloud.base] Authentication required for Account. (421)
2024-01-06 12:12:11.654 ERROR (SyncWorker_0) [pyicloud.base] Authentication required for Account. (450)
2024-01-06 12:12:11.654 ERROR (SyncWorker_0) [homeassistant.components.icloud.account] Unknown iCloud error: Authentication required for Account.

Can we have a chance of a review of this official integration?

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@FabioEight
Copy link

Issue still present on 2024.4.0.

@rcmaehl
Copy link
Contributor

rcmaehl commented Jul 1, 2024

I can confirm I was able to setup App-Specific Passwords for this Integration HomeAssistant. Can you all confirm that:

  • Your default 2FA/MFA is not currently set to a Security Token when setting up the App-Specific Password?
  • You're using the email selected as "Apple ID" from the Emails & Phone Numbers section of https://appleid.apple.com/account/manage/section/security?
  • You're using an Apple Device signed into the account that is/has connected to the same network as the HomeAssistant host?
  • You're able to sign into https://appleid.apple.com from a desktop web browser on the same network as the HomeAssistant host (and ideally create the App-Specific Password within that desktop web browser)?
  • You are polling iCloud no more than once every 60 seconds (I poll every 5 minutes) once setup?

@andrey-yantsen
Copy link

@rcmaehl I'm receiving the Invalid authentication error when trying to set up the integration using the App-Specific Password. Here's what I see in the logs:

Logger: homeassistant.components.icloud.config_flow
Source: components/icloud/config_flow.py:128
integration: Apple iCloud (documentation, issues)
First occurred: 11 July 2024 at 22:18:26 (4 occurrences)
Last logged: 11:05:42

Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

It's the same error as reported previously here: #57645 (comment) 🤷

As for your questions:

  • Your default 2FA/MFA is not currently set to a Security Token when setting up the App-Specific Password? Yes. I have only 1 trusted phone number & 5 trusted devices (and the OTP is delivered to the devices).
  • You're using the email selected as "Apple ID" from the Emails & Phone Numbers section of appleid.apple.com/account/manage/section/security? Yes
  • You're using an Apple Device signed into the account that is/has connected to the same network as the HomeAssistant host? Yes to both parts.
  • You're able to sign into appleid.apple.com from a desktop web browser on the same network as the HomeAssistant host (and ideally create the App-Specific Password within that desktop web browser)? Yes.
  • You are polling iCloud no more than once every 60 seconds (I poll every 5 minutes) once setup? No, since I can't finish the integration's initial setup 🤷

I hope this somehow helps. I'll be happy to assist with any required debugging.

@rcmaehl
Copy link
Contributor

rcmaehl commented Jul 15, 2024

@rcmaehl I'm receiving the Invalid authentication error when trying to set up the integration using the App-Specific Password. Here's what I see in the logs:

Logger: homeassistant.components.icloud.config_flow
Source: components/icloud/config_flow.py:128
integration: Apple iCloud (documentation, issues)
First occurred: 11 July 2024 at 22:18:26 (4 occurrences)
Last logged: 11:05:42

Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

It's the same error as reported previously here: #57645 (comment) 🤷

As for your questions:

  • Your default 2FA/MFA is not currently set to a Security Token when setting up the App-Specific Password? Yes. I have only 1 trusted phone number & 5 trusted devices (and the OTP is delivered to the devices).
  • You're using the email selected as "Apple ID" from the Emails & Phone Numbers section of appleid.apple.com/account/manage/section/security? Yes
  • You're using an Apple Device signed into the account that is/has connected to the same network as the HomeAssistant host? Yes to both parts.
  • You're able to sign into appleid.apple.com from a desktop web browser on the same network as the HomeAssistant host (and ideally create the App-Specific Password within that desktop web browser)? Yes.
  • You are polling iCloud no more than once every 60 seconds (I poll every 5 minutes) once setup? No, since I can't finish the integration's initial setup 🤷

I hope this somehow helps. I'll be happy to assist with any required debugging.

Please try this:

  1. Setup the integration using your iCloud email + Password.
  2. Once setup, reload the integration
  3. Deny the MFA prompt once received
  4. Once the Integration asks to Re-authenticate, enter the App-Specific Password you've created

@andrey-yantsen
Copy link

Thanks, @rcmaehl!

I think I'm stuck at step 3 😅 I did set up the integration using the regular password, but upon reloading (and restarting HA) the MFA prompt does not show up 🤷 Do you have any further suggestions, or should we just wait for when Apple decides to show the prompt?

@rcmaehl
Copy link
Contributor

rcmaehl commented Jul 15, 2024

Thanks, @rcmaehl!

I think I'm stuck at step 3 😅 I did set up the integration using the regular password, but upon reloading (and restarting HA) the MFA prompt does not show up 🤷 Do you have any further suggestions, or should we just wait for when Apple decides to show the prompt?

I'd give it some time. Although you can create an automation that uses any of the Apple iCloud actions which may make the prompt appear sooner but I haven't tested this yet.

@andrey-yantsen
Copy link

@rcmaehl I don't really have an update, but just wanted to share the current status: I have received a few emails from Apple (Your Apple ID was used to sign in to iCloud via a web browser), but nothing more than that. Reloading the integration still doesn't trigger the MFA prompt 🤷

@kerta1n
Copy link

kerta1n commented Jul 27, 2024

Issue persists on 2024.7.3

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@kerta1n
Copy link

kerta1n commented Oct 25, 2024

Issue still present on 2024.10.3

Logger: homeassistant.components.icloud.config_flow
Source: components/icloud/config_flow.py:128
integration: Apple iCloud (documentation, issues)
First occurred: 5:03:45 PM (4 occurrences)
Last logged: 5:04:15 PM

Error logging into iCloud service: ('Invalid email/password combination.', PyiCloudAPIResponseException('Service Temporarily Unavailable (503)'))

icloud.com was NOT down at the time I tried logging in
image

@lor74
Copy link

lor74 commented Oct 27, 2024

I am still getting this error

Registratore: pyicloud.base
Fonte: /usr/local/lib/python3.12/site-packages/pyicloud/base.py:188
Prima occorrenza: 10:21:04 (8 occorrenze)
Ultima registrazione: 10:23:45

    Service Temporarily Unavailable (503)
    Authentication required for Account. (450)

The relevant error is Auth required... and I got the same error for all Apple account.

Registratore: homeassistant.config_entries
Fonte: config_entries.py:594
Prima occorrenza: 26 ottobre 2024 alle ore 18:10:27 (5 occorrenze)
Ultima registrazione: 10:14:58

    Error setting up entry [email protected] for icloud
    Error setting up entry [email protected] for icloud
    Error setting up entry [email protected] 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 100, in async_setup_entry
    await hass.async_add_executor_job(account.setup)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/icloud/account.py", line 138, in setup
    api_devices = self.api.devices
                  ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyicloud/base.py", line 543, in devices
    return FindMyiPhoneServiceManager(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyicloud/services/findmyiphone.py", line 26, in __init__
    self.refresh_client()
  File "/usr/local/lib/python3.12/site-packages/pyicloud/services/findmyiphone.py", line 34, in refresh_client
    req = self.session.post(
          ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyicloud/base.py", line 131, in request
    return self.request(method, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyicloud/base.py", line 133, in request
    self._raise_error(response.status_code, response.reason)
  File "/usr/local/lib/python3.12/site-packages/pyicloud/base.py", line 189, in _raise_error
    raise api_error
pyicloud.exceptions.PyiCloudAPIResponseException: Authentication required for Account. (450)

@makcorner
Copy link

Same here - app password is simply not working.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@kerta1n
Copy link

kerta1n commented Jan 26, 2025

This issue still persists on 2025.1.4.

Logger: homeassistant.components.icloud.config_flow
Source: components/icloud/config_flow.py:128
integration: Apple iCloud (documentation, issues)
First occurred: 2:21:58 PM (2 occurrences)
Last logged: 2:22:01 PM

Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))```

@github-actions github-actions bot removed the stale label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests