question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ICloud integration gives invalid auth w/ app-specific pw

See original GitHub issue

The problem

I’m attempting to setup the iCloud integration w/ an app-specific password, per the instructions here.

Upon hitting submit, I get a short spinner and then “Invalid authentication” — and I cannot proceed beyond this error to finish setting up the icloud integration. I’ve also tried the suggested troubleshooting step of removing the .storage/icloud directory, to no avail. (which is created upon attempting to setup the integration, but removing it has no affect on the issue)

I have confirmed that I’ve entered the app-specific password correct, and attempted several different passwords I’ve generated on appleid.apple.com.

What is version of Home Assistant Core has the issue?

core-2021.7.4

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

icloud

Link to integration documentation on our website

https://www.home-assistant.io/integrations/icloud/#app-specific-passwords

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-08-03 23:05:32 ERROR (SyncWorker_40) [pyicloud.base] Missing apple_id field
2021-08-03 23:05:32 ERROR (MainThread) [homeassistant.components.icloud.config_flow] Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

Additional information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:46 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
dsfallercommented, Oct 15, 2021

I did more digging with the underlying pyicloud library (see comment in my issue there) - seems like pyicloud is emulating to be a web browser and not using any official API. Apparently, Apple changed the login flow or rejects app-specific passwords completely now - in any case the library no longer receives the necessary login tokens to work. My conclusion is that we need a rewrite of pyicloud for app-specific passwords or another library for the icloud plugin in Home Assistant… 😦

3reactions
magicuscommented, Nov 2, 2022

I’m currently in the process of replacing the standard icloud integration with icloud3. It is not really a smooth ride. Apparently icloud3 is much more capable, but that also means turning a lot more knobs to get it to work. Get me right, I love the kind of add-ons that gives you the full power to tweak anything, but for a default option in HA, there need to be a simple to use solution that solves most cases with good defaults.

I think icloud3 would need some work to get there, possibly splitting it in two, one simplified version to put in HA core, and one separate with full power. If the icloud3 developer(s) support this, I think it would be great, but it might not be painless for icloud3.

In fact, for me, the standard icloud solution was kind of perfect, except for the slightly annoying fact that it stopped working.

So an alternative is to just see what icloud3 does differently in terms of authentication, and copy that over to the standard icloud integration. Possibly it’s just a more up-to-date fork of pyicloud (pyicloud_ic3.py).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sign in to apps with your Apple ID using app-specific passwords
In the Sign-In and Security section, select App-Specific Passwords. Select Generate an app-specific password or select the Add button Blue plus ...
Read more >
How do I fix an authentication error with my iCloud account?
In the Security section, click Generate Password below App-Specific Passwords. Follow the steps on your screen. After you've enabled 2-factor ...
Read more >
Fantastical, iCloud, and Two-Factor Authentication - Flexibits
You can generate an app-specific password after you enable two-factor authentication on your iCloud account. We have a short video tutorial on how...
Read more >
FAQ - Unable to log into iCloud. I'm seeing password incorrect ...
I'm seeing password incorrect prompts. Apple requires all third-party apps that sync with iCloud (like BusyCal and BusyContacts) to use app-specific passwords - ......
Read more >
Cannot Connect to an iCloud Account | Spark Help Center
1. Enable the two-factor authentication. To generate an app-specific password, make sure you have two-factor authentication enabled. Note: Some ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found