Skip to content
rhoopr edited this page May 18, 2026 · 3 revisions

login

Authenticate with iCloud and validate your session. It doesn't download anything.

Usage

# Interactive login - prompts for 2FA code
kei login

# Headless / Docker - two-step flow
kei login get-code
kei login submit-code 123456

The account comes from [auth].username in the config file, or from ICLOUD_USERNAME for automation.

Subcommands

Subcommand Description
none Authenticate interactively. Prompts for a 2FA code if needed.
get-code Request a 2FA code be pushed to your trusted devices.
submit-code <code> Submit a 6-digit 2FA code non-interactively.

Running kei login without a subcommand handles SRP authentication, 2FA prompt, and session persistence. If the session is already valid, it exits immediately.

Headless 2FA

For Docker or cron environments where there's no TTY, split the flow into two steps:

  1. Run kei login get-code to trigger a 2FA push to trusted Apple devices.
  2. Read the code, then run kei login submit-code 123456.

The code accepts spaces and dashes, such as 123 456 or 123-456; only the 6 digits matter.

See Docker for the full headless setup workflow.

Runtime flags

Flag Description
--config Config file path
-p, --password iCloud password
--password-file Read password from a file
--password-command Run a command to get the password

Related

Commands

Getting Started

Features

Clone this wiki locally