Core: iCloud configuration does not work - 2FA

Created on 18 Mar 2018  路  14Comments  路  Source: home-assistant/core

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.65.3

Python release (python3 --version):
Python 3.6 bundled in official docker container

Component/platform:
icloud

Description of problem:
Confirming of 2FA authentication code does not work

Expected:
It should work ;)

Problem-relevant configuration.yaml entries and steps to reproduce:

- platform: icloud
  username: !secret icloud_username
  password: !secret icloud_password
  account_name: !secret icloud_accountname

Traceback (if applicable):

Log Details (ERROR)
Sun Mar 18 2018 15:01:23 GMT+0100 (CET)

Error executing service <ServiceCall configurator.configure: configure_id=140340652962424-1, fields=trusted_device=899242>
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1006, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/src/app/homeassistant/components/configurator.py", line 224, in async_handle_service_call
    call.data.get(ATTR_FIELDS, {}))
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/device_tracker/icloud.py", line 204, in icloud_trusted_device_callback
    self._trusted_device = self.api.trusted_devices[self._trusted_device]
IndexError: list index out of range
icloud stale waiting-for-reply

Most helpful comment

Just now successfully added my icloud account to hass.io 0.68.0 on raspberry pi 3b with 2FA

you need to add code to your configuration.yaml, as described here - https://www.home-assistant.io/components/device_tracker.icloud/

device_tracker:

  • platform: icloud
    username: USERNAME
    password: PASSWORD
    account_name: accountname

if you already have device_tracker object it's not need to add once again

after homeassistant restart you receive a message that somebody try to log into your account on your validated apple device and you will see a new object on dashboard, called icloud with "configure" button. There was a list from my cellular phone numbers (in my case only one with code 0) and area to input device code. After entering 0 and accepting i receive a SMS message to my phone, which you need to enter into icloud object on dashboard.

Relatively easy and works as should. Try and good luck :)

All 14 comments

Same error on hass.io 0.68.0 on RasPi 3B

Just now successfully added my icloud account to hass.io 0.68.0 on raspberry pi 3b with 2FA

you need to add code to your configuration.yaml, as described here - https://www.home-assistant.io/components/device_tracker.icloud/

device_tracker:

  • platform: icloud
    username: USERNAME
    password: PASSWORD
    account_name: accountname

if you already have device_tracker object it's not need to add once again

after homeassistant restart you receive a message that somebody try to log into your account on your validated apple device and you will see a new object on dashboard, called icloud with "configure" button. There was a list from my cellular phone numbers (in my case only one with code 0) and area to input device code. After entering 0 and accepting i receive a SMS message to my phone, which you need to enter into icloud object on dashboard.

Relatively easy and works as should. Try and good luck :)

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 :+1:

This still doesn't work with 2FA. Any chance it'll be updated to add this support? A lot of iCloud functions won't work without it so it's almost mandatory to have turned on now.

It looks like with the current version (0.82.0) I was able to successfully use SMS based 2FA but only with my primary iCloud password (the same one I use when setting up a new phone etc.) but does not appear to work at all when using app-specific passwords as demonstrated here:
https://support.apple.com/en-ca/HT204397

I'm glad that things are working but am still a bit uncomfortable with having my iCloud password stored in plain text regardless of other safety measures such as 2FA.

Just now successfully added my icloud account to hass.io 0.68.0 on raspberry pi 3b with 2FA

you need to add code to your configuration.yaml, as described here - https://www.home-assistant.io/components/device_tracker.icloud/

device_tracker:

  • platform: icloud
    username: USERNAME
    password: PASSWORD
    account_name: accountname

if you already have device_tracker object it's not need to add once again

after homeassistant restart you receive a message that somebody try to log into your account on your validated apple device and you will see a new object on dashboard, called icloud with "configure" button. There was a list from my cellular phone numbers (in my case only one with code 0) and area to input device code. After entering 0 and accepting i receive a SMS message to my phone, which you need to enter into icloud object on dashboard.

Relatively easy and works as should. Try and good luck :)

This fixed mine. The wording on the popup notification is confusing. I thought it wanted me to enter the 2FA code that popped up on my screen, not 0 for the number and then the text code. If no one pull requests the icloud code, I'll do it and change the wording to make it more clear. Thanks for posting this!

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 :+1:

Is this still an issue you are experiencing? Can you please try upgrading to the latest version of Home Assistant (0.90) and report back if this is still a problem? Thanks!

Is this still an issue you are experiencing? Can you please try upgrading to the latest version of Home Assistant (0.90) and report back if this is still a problem? Thanks!

Hi. Actually i never had problems with iCloud device tracker until 0.90. Since i upgraded to 0.90, HA is asking to provide 2FA for most of my devices every HA restart. After providing the correct 2FA the warning goes away, but it comes back on next restart

I get the same issue as Dinth. I think there is some confusion here with 2 step auth and 2 factor auth. 2 step auth will send an SMS. 2 factor auth (the issue here) involves an apple auth request to an apple device and not an SMS. The docs mention that the pyicloud library doesn't support 2FA yet. There's an issue logged for that on the pyicloud github repo that's been open since 2016. There doesn't look like there's lots of activity over there though these days.

I get the same issue as Dinth.

Hi @giwleb, actually i have managed to resolve the issue yesterday.
My HA was working fine for ages, so i actually forgotten how to do 2FA in HA :) But yesterday i tried the right way and the problem went away.
Anyhow, once you reboot HA, your devices will show a popup asking you if you want to allow connection. You must click "Dont allow" button here and only there you can click on HA notification, choose "0" for SMS verification. SMS verification should work.

I must either be doing it wrong or it's different for me. I restarted HA, and got the pop-up on my iphone saying that a sign in was requested. I clicked 'Don't allow' and then '0' on the first configurator notification on HA (SMS to xxxx). Then, as it usually does, it shows another configurator notification asking for the code. No SMS is ever received since I don't use 2SV (2 step verification). 2FA never involves a SMS message or iMessage message.

bump

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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings