Login Command

The login command in the PxPlus Package Manager allows you to sign in to your pxpm account. It ensures API connectivity needed for tasks such as uploading or downloading private packages.

Synopsis

login [--token <api-key>]

Description

When you run the login command, the following steps occur:

  1. API Connectivity Check:
    The command first verifies that the API is accessible. If the API cannot be reached, a NoApiAccessException is thrown.

  2. Existing Session Check:
    If a user is already logged in, the command displays the current user's email and asks if you want to continue and log in as a different user.

  3. Credential Prompt:
    The command interactively prompts you for your email and password.

    • Email: Must be provided and cannot be empty.
    • Password: Input is hidden for security and also cannot be empty.

Parameters

By default, the login command does not require any command-line parameters. Instead, it interactively requests the following inputs:

  • Email: Your login email address.
  • Password: Your account password (input is hidden).

Flags

  • --token \<api-key> (pxpm 1.1.0+): Log in non-interactively using an API key created on the pxpm website (Account menu → API Keys). The key is validated against the API and stored as your session — no email or password prompts. Use this to log in a build or deploy machine once.

Non-Interactive Authentication (CI/Deploy)

For headless environments such as deploy scripts and CI pipelines, there are two options (pxpm 1.1.0+):

  1. PXPM_TOKEN environment variable (recommended): Set PXPM_TOKEN to an API key and every pxpm command will authenticate with it automatically. It takes precedence over any stored login and nothing is written to disk:
PXPM_TOKEN=<your-api-key> pxpm install
  1. --token flag: Log the machine in once; the key is stored as the session just like an interactive login:
pxpm login --token <your-api-key>

Note: While PXPM_TOKEN is set, pxpm logout will not log you out (unset the variable instead), and any interactive login will be overridden by the environment variable.

Examples

  • To log in to your account:
login
  • To log in with an API key (non-interactive):
login --token <your-api-key>

Output

  • Success:
    A message confirming a successful login is displayed along with your email address.

  • Failure:
    If the login fails due to incorrect credentials or other issues, an error message is displayed.

Exceptions

  • NoApiAccessException:
    Thrown if the API is not accessible.

  • Exception:
    Thrown if the email or password is empty.

  • Other Exceptions:
    Additional errors during the authentication process are caught and logged accordingly.