core icon indicating copy to clipboard operation
core copied to clipboard

ICloud integration gives invalid auth w/ app-specific pw

Open jkrall opened this issue 4 years ago • 89 comments

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

jkrall avatar Aug 04 '21 05:08 jkrall

icloud documentation icloud source (message by IssueLinks)

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)

same here, app password doesn't work.

Salvora avatar Aug 04 '21 21:08 Salvora

same for me

N3rdix avatar Aug 05 '21 14:08 N3rdix

same: these occur in logs Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

MattLParker avatar Aug 05 '21 23:08 MattLParker

Bump!

shivindera avatar Aug 06 '21 10:08 shivindera

i am facing the same issue.

Any update on same

shailyglobal83 avatar Aug 10 '21 09:08 shailyglobal83

i am waiting for this issue to get resolve ASAP because my presence detection automation is completely blocked because of that issue .Please respond if there is any update regarding this issue. Thanks in advance.

shailyglobal83 avatar Aug 10 '21 16:08 shailyglobal83

same here

tommekevda avatar Aug 19 '21 13:08 tommekevda

I'm experiencing the same running 2021.8.8. Both with my actual icloud pw as well as app specific pw. I've also tried with 2 separate icloud accounts. Additionally i've spun up multiple VM's to try and isolate all other factors and have even downgraded Core to 2021.7.x which is where I had it running last but even that doesn't seem to work. My assumption was the the version of Core was potentially the issue but now I'm wondering if the integration itself has a 'version' that isn't manageable within the context of HA itself and potentially that is the issue. I've spent quite a bit of time trying to isolate this and can't figure out what is different...

The specific behavior for me is after entering my un/pw on the below screen, I get the Apple prompt immediately asking to allow a login. I proceed to the 6 digit code dialog but the dialog below just spins continuously for a very long time and i never get prompted to enter the code.

2021-08-30_13-34-07

pauly7300 avatar Aug 30 '21 18:08 pauly7300

I have the same experience as @pauly7300

I'm experiencing the same running 2021.8.8. Both with my actual icloud pw as well as app specific pw. I've also tried with 2 separate icloud accounts. Additionally i've spun up multiple VM's to try and isolate all other factors and have even downgraded Core to 2021.7.x which is where I had it running last but even that doesn't seem to work. My assumption was the the version of Core was potentially the issue but now I'm wondering if the integration itself has a 'version' that isn't manageable within the context of HA itself and potentially that is the issue. I've spent quite a bit of time trying to isolate this and can't figure out what is different...

The specific behavior for me is after entering my un/pw on the below screen, I get the Apple prompt immediately asking to allow a login. I proceed to the 6 digit code dialog but the dialog below just spins continuously for a very long time and i never get prompted to enter the code.

<img alt="2021-08-30_13-34-07" width="468" src="https://user-images.githubusercontent.com/11494052/131388098-1df4ba36-513f-4ce4-8cff-b9648103beff.png"

david-schwartz-by avatar Sep 02 '21 21:09 david-schwartz-by

Same issue on 2021.9.1

Error in logs:

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

sarabveer avatar Sep 03 '21 03:09 sarabveer

Same issue, same error, same logs here on latest HAOS with latest Core, Supervisor versions. Can I help somehow to fix it?

thomasfr avatar Sep 15 '21 10:09 thomasfr

Same issue here with app-specific password... I played a little bit with the underlying code samples of pyiCloud (https://github.com/picklepete/pyicloud) and the sample code showed the same error when using my AppleID / app-specific password... raising a ticket there and hoping that the developer will react.

dsfaller avatar Sep 20 '21 15:09 dsfaller

Thanks for the update

thomasfr avatar Sep 20 '21 21:09 thomasfr

I'm experiencing the same running 2021.8.8. email address and password are accepted. But verification code is accepted and constantly rejected by the iCloud integration app. Logger: homeassistant.components.icloud.config_flow Source: components/icloud/config_flow.py:272 Integration: Apple iCloud (documentation, issues) First occurred: 2:11:28 AM (2 occurrences) Last logged: 2:11:37 AM

Failed to verify verification code: (401)

ushroff avatar Sep 27 '21 06:09 ushroff

I have the same issue too...

mada199122 avatar Oct 07 '21 06:10 mada199122

Is there going to be a resolution for this? It seems as though this hasn't been noticed by a developer

Andavin avatar Oct 10 '21 21:10 Andavin

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... :(

dsfaller avatar Oct 15 '21 17:10 dsfaller

bad news.. thanks any way....

mada199122 avatar Oct 19 '21 09:10 mada199122

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[bot] avatar Jan 17 '22 10:01 github-actions[bot]

still an issue

rasmusbe avatar Jan 17 '22 14:01 rasmusbe

Same for me, still can't login using the app specific pw, getting Invalid authentication error. In the logs: 2022-01-18 09:08:43 ERROR (SyncWorker_3) [pyicloud.base] Missing apple_id field 2022-01-18 09:08:43 ERROR (MainThread) [homeassistant.components.icloud.config_flow] Error logging into iCloud service: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field'))

eappels avatar Jan 18 '22 08:01 eappels

same here :( even deleting the .storage/icloud/ folder and restarting did not work

OlafKocanda avatar Feb 07 '22 14:02 OlafKocanda

this is not being actively worked on, don't' expect any fixes. I have abandoned this integration, should be marked broken IMHO.

vajonam avatar Feb 07 '22 20:02 vajonam

same here :( even deleting the .storage/icloud/ folder and restarting did not work

Same here.

VonLuderitz avatar Feb 08 '22 13:02 VonLuderitz

Same as everyone else :( give app specific passwords unto me!

thenoid avatar Feb 23 '22 18:02 thenoid

I've had a little dive into this, and it seems completely impossible to use app-passwords the way it's currently setup. The icloud integration uses the icloud web interface and the web interface does not appear to support app passwords.

I'm not sure if apple actually exposes the "find my" api through regular means. If they do, it might be possible to completely rewrite this but I'm expecting that they do not support 3rd party access to "find my".

wolph avatar Apr 04 '22 11:04 wolph

Any news for this? Here same, dosent work anymore and icloud forder + restart dont help even :(

JuhaFIN1 avatar May 05 '22 08:05 JuhaFIN1

I have the same issue as well. Way beyond my league to even consider fixing it, but it would really be appreciated!

medivb avatar May 11 '22 10:05 medivb