Skip to content

apkg login

The login command authenticates you with the APKG registry. Credentials are stored in ~/.apkg/credentials.json and used automatically by commands that require authentication, such as publish, token, and key.

Terminal window
apkg login [--registry <URL>]

The command prompts interactively for your username and password. If your account has multi-factor authentication (MFA) enabled, you will also be prompted for a TOTP code or recovery code.

OptionDescription
--registry <URL>Override the registry URL for this login session

The --registry flag is a global option available to all commands. When provided, it takes precedence over the APKG_REGISTRY environment variable and any value set via apkg config set registry.

  1. Username — enter your APKG account username.
  2. Password — enter your password (input is masked).
  3. MFA — if MFA is enabled on your account, enter a TOTP code from your authenticator app or a recovery code.

On success the CLI prints Logged in as <username> and stores an access token and refresh token locally.

Credentials are saved to ~/.apkg/credentials.json with the following structure:

{
"registry": "https://api.apkg.ai",
"accessToken": "tok_abc123…",
"refreshToken": "rt_def456…",
"username": "your-username"
}

Each credential set is scoped to a registry URL. The registry is resolved in this order:

  1. --registry flag (if provided)
  2. APKG_REGISTRY environment variable
  3. Value set via apkg config set registry
  4. Default: https://api.apkg.ai

Log in to the default registry:

Terminal window
apkg login

Log in to a private registry:

Terminal window
apkg login --registry https://registry.internal.example.com

Verify who you are authenticated as after logging in:

Terminal window
apkg whoami
CommandDescription
logoutRemove stored credentials
whoamiShow the authenticated user
configManage CLI configuration
tokenManage long-lived API tokens