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.
Synopsis
Section titled “Synopsis”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.
Options
Section titled “Options”| Option | Description |
|---|---|
--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.
Authentication flow
Section titled “Authentication flow”- Username — enter your APKG account username.
- Password — enter your password (input is masked).
- 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.
Credential storage
Section titled “Credential storage”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:
--registryflag (if provided)APKG_REGISTRYenvironment variable- Value set via
apkg config set registry - Default:
https://api.apkg.ai
Examples
Section titled “Examples”Log in to the default registry:
apkg loginLog in to a private registry:
apkg login --registry https://registry.internal.example.comVerify who you are authenticated as after logging in:
apkg whoamiRelated commands
Section titled “Related commands”| Command | Description |
|---|---|
logout | Remove stored credentials |
whoami | Show the authenticated user |
config | Manage CLI configuration |
token | Manage long-lived API tokens |