Icloud connect not working: HTTP error 400

Hi all,

I just tried:

rclone --user-agent=”newtext" config reconnect iclouddrive:

rclone does not generate any errors but it is asking for and waiting for a two-factor authentication code and rclone is not doing anything to force Apple to send me a two-factor authentication code to my phone so I have no code to enter and now I'm stuck yet again.

I don't have any Apple devices that are trusted devices so the only option I have is two-factor authentication Via SMS.

When I try and log into my account in a web browser I am prompted for sending my SMS code to my phone and I get the code to my phone and I enter it to the website and I can log in.

I just don’t know how to make rclone tell Apple to send me the code.

Apparently you're not allowed to use an authenticator app which is what I was going to try and do.

Does anyone have any ideas on how to get around the two-factor Authentication debacle that I am in?

How are you in the Apple ecosystem with no Apple devices that are trusted like a phone, iPad or computer?

Apple does not really allow bypassing stuff like that.

Hi,

I signed up for a free icloud account. I can log in and see the pictures and files I have there.

When I try to log in via a browser I get an SMS code sent to my phone. I also receive an email from Apple letting me know that I have successfully logged in.

When I run rclone Apple lets me know via email that I have logged in via a browser even though I have not successfully completed the rclone 2fa.

Every time I try and re-establish my rclone remote even though I have not completed the two-factor Authentication I get an email from Apple saying that I was successfully logged in Via a web browser even though I really wasn’t.

“Your Apple Account was used to sign in to iCloud via a web browser.”

Dear Joe Schmo,
Your Apple Account (schmojoe@email.com) was used to sign in to iCloud via a web browser.
Date and Time: September 4, 2025, 12:07 PM PDT”

HERE is what the attempt looks like with DEBUG -vv enabled:

C:\Users\king>rclone -vv --user-agent="MyCloud" config reconnect dkicloud:
2025/09/04 20:13:40 DEBUG : rclone: Version "v1.71.0" starting with parameters ["rclone" "-vv" "--user-agent=MyCloud" "config" "reconnect" "dkicloud:"]
2025/09/04 20:13:40 DEBUG : Using config file from "C:\Users\king\AppData\Roaming\rclone\rclone.conf"
2025/09/04 20:13:40 DEBUG : dkicloud: config in: state="", result=""
2025/09/04 20:13:40 DEBUG : icloud: Authenticating as schmo@gmail.com
2025/09/04 20:13:41 DEBUG : Saving config "cookies" in section "dkicloud" of the config file
2025/09/04 20:13:41 DEBUG : Keeping previous permissions for config file: -rw-rw-rw-
2025/09/04 20:13:41 DEBUG : dkicloud: config out: out=&{State:2fa_do Option: OAuth: Error: Result:}, err=
2025/09/04 20:13:41 DEBUG : dkicloud: config: reading config parameter "config_2fa"
Option config_2fa.
Two-factor authentication: please enter your 2FA code
Enter a value.
config_2fa>

My phone never receives an SMS with the code the way it does when using a browser.

Can confirm. Worked for me as well. Thanks!

thank you!!! this worked. so grateful to have it back up and running after two months

It seems to work for me too. Interestingly, I seem to get two 2FA requests in doing the config. Entering the first 2FA number worked.

I’ve seen the same two 2FA interactions where the second one seems superfluous. I don’t think that’s new though, I’ve always had that happen when I config reconnect.

I have the same issue, all i have is a MacOS VM and in the past I’ve had to use that to get the 2fa code, usually when signing in via the webbrowser theres an option to request a code via sms, but I’m guessing rclone doesnt have anything implemented to do that. which is annoying.

1 Like

I used the methodrclone --user-agent="your-own-random-string" config reconnect icloud:and received the verification code, but immediately after I got the error:

HTTP error 302 (302 Found) returned body: "{\"domainToUse\":\"iCloud.com.cn\"}"

What causes this? Does it mean that rclone does not support iCloud in mainland China?:smiling_face_with_tear:

Correct.

Work in progress:

1 Like

Trying to set up rclone for first time and with icloud as the backend. I also got 400 on config until adding a random user agent. I’m still stuck on completing the 2FA process. My iPhone is receiving the 2FA prompt, which I allow and then type the corresponding code into rclone. rclone exits with Fatal error: validate2FACode failed: HTTP error 412 (412 ) and a long body which doesn’t appear to have any obvious problem in it. I get the email from Apple about successful login from the web, but rclone is not completing enough to store the icloud trust token. I notice I get two 2FA prompts on my phone in this process. First one when client prompts config_2fa> and again when the config process fails out.

I also had this problem and as it was mentioned above the problem was solved with the flag “–user-agent”, but I couldn’t solve it with random string. Instead I used my rclone version like this and it worked:

rclone --user-agent="rclone/1.71.1" config