Hi!
After the update to OHAB 3.4.0 I have set up the iCloud binding. Worked perfectly well for the first account. But when I tried to set up a second iCloud account it failed with “Invalid 2-FA-code.”
What I did:
- Create a new iCloud account thing
- Set up username and password
- Save the thing
- Got message on the iPhone with 2FA Code
- Set up 2FA code in the thing config
- Save the thing
- Got the error message “Invalid 2-FA-code.”
The logs:
2022-12-29 16:04:30.989 [DEBUG] [org.openhab.binding.icloud.internal.ICloudService ] - Checking session token validity
2022-12-29 16:04:30.999 [DEBUG] [org.openhab.binding.icloud.internal.ICloudSession ] - iCloud request POST https://setup.icloud.com/setup/ws/1/validate.
2022-12-29 16:04:31.425 [DEBUG] [org.openhab.binding.icloud.internal.ICloudService ] - Token is not valid. Attemping new login.
org.openhab.binding.icloud.internal.ICloudApiResponseException: Request https://setup.icloud.com/setup/ws/1/validate failed with 421.
at org.openhab.binding.icloud.internal.ICloudSession.request(ICloudSession.java:148) ~[?:?]
at org.openhab.binding.icloud.internal.ICloudSession.post(ICloudSession.java:98) ~[?:?]
at org.openhab.binding.icloud.internal.ICloudService.validateToken(ICloudService.java:190) ~[?:?]
at org.openhab.binding.icloud.internal.ICloudService.authenticate(ICloudService.java:94) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.checkLogin(ICloudAccountBridgeHandler.java:341) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.callApiWithRetryAndExceptionHandling(ICloudAccountBridgeHandler.java:167) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.lambda$2(ICloudAccountBridgeHandler.java:130) ~[?:?]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]
2022-12-29 16:04:31.460 [DEBUG] [org.openhab.binding.icloud.internal.ICloudService ] - Authenticating as xxx@xxx.com...
2022-12-29 16:04:31.462 [DEBUG] [org.openhab.binding.icloud.internal.ICloudSession ] - iCloud request POST https://idmsa.apple.com/appleauth/auth/signin?isRememberMeEnabled=true.
2022-12-29 16:04:32.838 [DEBUG] [org.openhab.binding.icloud.internal.ICloudSession ] - iCloud request POST https://setup.icloud.com/setup/ws/1/accountLogin.
2022-12-29 16:04:47.521 [DEBUG] [org.openhab.binding.icloud.internal.ICloudSession ] - iCloud request POST https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode.
2022-12-29 16:04:47.998 [DEBUG] [org.openhab.binding.icloud.internal.ICloudService ] - Code verification failed.
org.openhab.binding.icloud.internal.ICloudApiResponseException: Request https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode failed with 412.
at org.openhab.binding.icloud.internal.ICloudSession.request(ICloudSession.java:148) ~[?:?]
at org.openhab.binding.icloud.internal.ICloudSession.post(ICloudSession.java:98) ~[?:?]
at org.openhab.binding.icloud.internal.ICloudService.validate2faCode(ICloudService.java:246) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.handle2FAAuthentication(ICloudAccountBridgeHandler.java:244) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.callApiWithRetryAndExceptionHandling(ICloudAccountBridgeHandler.java:170) ~[?:?]
at org.openhab.binding.icloud.internal.handler.ICloudAccountBridgeHandler.lambda$2(ICloudAccountBridgeHandler.java:130) ~[?:?]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]
The binding is version 3.4.0
openhab> bundle:list | grep iCloud
337 │ Active │ 80 │ 3.4.0 │ openHAB Add-ons :: Bundles :: iCloud Binding
openhab>
I’ve tried multiple times, no change.
I have no clue what I’m doing wrong, so my questions are:
Anything obviously wrong in my config?
Is the binding good for multiple accounts?
Thanks,
Jens