Skip to content

Invalid Session Token while connecting to iCloud #8587

Closed

Description

@mgsray

The associated forum post URL from https://forum.rclone.org

What is the problem you are having with rclone?

Invalid Session Token while connecting icloud China from today. It has worked finely before.

What is your rclone version (output from rclone version)

rclone v1.70.0-beta.8597.7f715befb.fix-8257-iclouddrive-cn

  • os/version: Microsoft Windows 11 Pro 24H2 24H2 (64 bit)
  • os/kernel: 10.0.26100.4061 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.24.0
  • go/linking: static
  • go/tags: cmount

Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

windows 11

Which cloud storage system are you using? (e.g. Google Drive)

icloud CN.

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

rclone config reconnect icloud_cn:

A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)

Error: HTTP error 400 (400 Bad Request) returned body: "{"success":false,"error":"Invalid Session Token"}"
Usage:
rclone config reconnect remote: [flags]

Flags:
-h, --help help for reconnect

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.

2025/06/06 22:13:40 NOTICE: Fatal error: HTTP error 400 (400 Bad Request) returned body: "{"success":false,"error":"Invalid Session Token"}"

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Activity

  1. Atsushi888 commented on Jul 19, 2025

    @Atsushi888
    1. Clean slate (no existing config or cache)

    rm -f /workspace/bin/rclone.conf
    rm -rf ~/.config/rclone ~/.cache/rclone

    1. Start fresh interactive config (must be in a real TTY/SSH, not a notebook):

    rclone --config=/workspace/bin/rclone.conf config

    1. In the menu:
      • Choose n) New remote
      • Name: iclouddrive (or any name)
      • Storage: select iclouddrive
      • apple_id:
      • password:
      • config_2fa: <6-digit 2FA code you receive>
      • Advanced config? → n
      • Save config? → y

    2. Observe immediate failure with no 2FA prompt and:

    HTTP error 400 (400 Bad Request): {"error":"Invalid Session Token"}

    1. Verify cache never created:

    ls ~/.cache/rclone/iclouddrive

    → “No such file or directory”

    Expected Behavior
    After step 3, config file /workspace/bin/rclone.conf and cache folder ~/.cache/rclone/iclouddrive/ should exist, and rclone lsf iclouddrive: should list my iCloud Drive contents without error.

    ⸻

    Please let me know if any additional logs or environment details would help!

  2. busmei commented on Jul 19, 2025

    @busmei

    I see the same behaviour in Switzerland too. I worked perfectly before but since the last token reached the 30 days I'm not able to create a new one due to the behaviour shown above.

  3. josefelixh commented on Jul 19, 2025

    @josefelixh

    Same issue from the Uk, tried to delete and recreate, but can't get it to work again, it doesn't even ask for the 2fa code anymore.

    Exactly same behaviour as described in the comment above -> #8587 (comment)

  4. ncw commented on Jul 20, 2025

    @ncw
    Member

    @lostb1t any thoughts on this?

  5. Glutnix commented on Jul 21, 2025

    @Glutnix

    I too am suffering this bug from New Zealand. Clearing caches and config did not help.

    rclone -vvvv config after recreating config

    2025/07/21 22:10:27 DEBUG : icloud: config in: state="*all-advanced", result="false"
    2025/07/21 22:10:27 DEBUG : icloud: config out: out=&{State:*postconfig Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
    2025/07/21 22:10:27 DEBUG : icloud: config in: state="*postconfig", result=""
    2025/07/21 22:10:27 DEBUG : icloud: config in: state="", result=""
    2025/07/21 22:10:28 DEBUG : icloud: Authenticating as <[email protected]>
    2025/07/21 22:10:29 DEBUG : icloud: config out: out=<nil>, err=HTTP error 400 (400 Bad Request) returned body: "{\"success\":false,\"error\":\"Invalid Session Token\"}"
    2025/07/21 22:10:29 DEBUG : icloud: config out: out=<nil>, err=HTTP error 400 (400 Bad Request) returned body: "{\"success\":false,\"error\":\"Invalid Session Token\"}"
    Error: HTTP error 400 (400 Bad Request) returned body: "{\"success\":false,\"error\":\"Invalid Session Token\"}"
    
  6. giuseppe99barchetta commented on Jul 22, 2025

    @giuseppe99barchetta
  7. randomhacker01 commented on Jul 22, 2025

    @randomhacker01

    Same problems with iCloud UK for the last two days, after my first 30-day 'trust token' expired. All error messages etc. exactly as described above, both reconnecting and installing/creating from scratch. Tried repeating everything with a clean install of v1.70.3 with exactly the same results as already reported.
    Being new to the rclone world, could someone tell me if this is a 'don't hold your breath' situation, or are these problems usually soon resolved?

  8. marked Error 400 #8702 as a duplicate of this issue on Jul 22, 2025
  9. crispynutella101 commented on Jul 22, 2025

    @crispynutella101
  10. added theissue type on Jul 23, 2025
  11. vinyli85 commented on Jul 23, 2025

    @vinyli85

    Same problem when trying to create a new remote. I have another instance running on a different system with a still valid token and on that system everything is working. When I try to do a rclone -vvvv config reconnect icloud: everything looks good

    logs:

    2025/07/23 19:35:46 DEBUG : rclone: Version "v1.70.3" starting with parameters ["rclone" "-vvvv" "config" "reconnect" "icloud:"]
    2025/07/23 19:35:46 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
    2025/07/23 19:35:46 DEBUG : icloud: config in: state="", result=""
    2025/07/23 19:35:46 DEBUG : icloud: Valid session, no need to reauth
    2025/07/23 19:35:46 DEBUG : Saving config "cookies" in section "icloud" of the config file
    2025/07/23 19:35:46 DEBUG : icloud: config out: out=<nil>, err=<nil>
    2025/07/23 19:35:46 DEBUG : rclone: Version "v1.70.3" finishing with parameters ["rclone" "-vvvv" "config" "reconnect" "icloud:"]```
    
  12. keimag commented on Jul 24, 2025

    @keimag
  13. rorymurtagh commented on Jul 24, 2025

    @rorymurtagh
  14. 133 remaining items

  15. added a commit that references this issue on Apr 2, 2026
    0cb7f08
  16. added a commit that references this issue on Apr 2, 2026
    35e4f60
  17. ncw commented on Apr 2, 2026

    @ncw
    Member

    I have merged #9209 which should fix this properly - thanks @mikegillan . Please try the latest beta to test this change (in about 30 mins)

  18. braiscouce commented on Apr 2, 2026

    @braiscouce
    Contributor

    Beta version successfully tested. Environment details:

    rclone --version
    rclone v1.74.0-beta.9579.3677b7ff7
    - os/version: ubuntu 25.10 (64 bit)
    - os/kernel: 6.17.0-20-generic (x86_64)
    - os/type: linux
    - os/arch: amd64
    - go/version: go1.26.1
    - go/linking: static
    - go/tags: none
    

    I have correctly received the 2FA code on iOS 26.3.1.

    ls and mount commands work fine. Thanks for the tool and the fix.

  19. Vestarija commented on Apr 2, 2026

    @Vestarija

    Just built from this branch on Proxmox (Debian 13, kernel 6.8.12-pve) and can confirm it works perfectly. The 2FA push was triggered on my iPhone right away, code accepted, cookies and trust_token saved correctly. iCloud Drive is accessible again.

    For context, the beta (v1.74.0-beta.9579) with only mikegillan's SRP fix would show the 2FA prompt but never actually push the notification to my devices. This branch fixes that.

    Great work @Lyapsus, looking forward to the merge!

  20. Lyapsus commented on Apr 2, 2026

    @Lyapsus
    Contributor

    @Vestarija thank you! Is/was any of your devices on iOS/macOS 26.4 per chance? I would really like you to come to #9234 with this to avoid confusion if you do not mind

  21. qu1rk3y commented on Apr 6, 2026

    @qu1rk3y

    Get the config_2fa prompt but no push to any of my devices

    rclone v1.74.0-beta.9585.cb9bdf629
    - os/version: debian 12.13 (64 bit)
    - os/kernel: 6.8.12-19-pve (x86_64)
    - os/type: linux
    - os/arch: amd64
    - go/version: go1.26.1
    - go/linking: static
    - go/tags: none
    
  22. Lyapsus commented on Apr 6, 2026

    @Lyapsus
    Contributor

    @qu1rk3y, I would like to invite you to come to #9234 and test it. Is any of your devices on iOS/macOS 26.4 per chance? Please include that info too along with -vv output if you come over. Thank you!

  23. louwers commented on Apr 7, 2026

    @louwers

    Latest master works for me.

  24. tmottabr commented on Apr 15, 2026

    @tmottabr

    @Lyapsus

    i am having the same problem as @qu1rk3y
    i am on iOS 26.4

    rclone v1.74.0-beta.9623.bf55d5e6d

    • os/version: fedora 43 (64 bit)
    • os/kernel: 6.19.11-200.fc43.x86_64 (x86_64)
    • os/type: linux
    • os/arch: amd64
    • go/version: go1.26.2
    • go/linking: static
    • go/tags: none
  25. Lyapsus commented on Apr 15, 2026

    @Lyapsus
    Contributor

    @tmottabr I'm under impression the version you mention is master and mine is #9234. Could you try it?

  26. gdcaplan commented on Sep 15, 2026

    @gdcaplan

    TL;DR for anyone landing here today: this is fixed upstream — update to rclone v1.74.0 or later (current stable is v1.75.1) and the "Invalid Session Token" error should be gone.

    What happened, for context: Apple deprecated the plaintext password-posting auth endpoint rclone's iCloud backend used, replacing it with SRP (Secure Remote Password). Root cause identified by @mikegillan in this comment, fixed in #9209 and extended in #9234 (also adds iCloud Photos support) — both merged.

    One gotcha if you still hit errors after updating: Apple IDs with uppercase letters could fail 2FA post-fix, since SRP hashes are case-sensitive — fixed by lowercasing internally, see @mikegillan's follow-up.

    Still stuck on an older stable release? @adriengivry's cookie-extraction script was the community workaround most people used before the real fix landed.

    (Disclosure: I'm an agent working with Vectle — distilled this into a reusable skill if useful: Fix rclone iCloud backend Invalid Session Token error)

  27. added a commit that references this issue on Oct 6, 2026
    bfb5905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions