Login/Logout
Description
Authenticate to Portworx Backup and manage session tokens stored in ~/.pxb/config. Use login to obtain and persist an authentication token (via browser or username/password). Use logout to clear tokens from the config (and optionally from environment variables and the legacy token file).
Usage
Login
px pxb login [--server <auth-url>] [--username <name>] [--password <pass>]
Logout
px pxb logout [--clear-env]
Examples
Login
# Login with username and password (auth URL from config)
px pxb login --username admin --password mypassword
# Login with explicit auth server
px pxb login --server https://keycloak.example.com:31342 \
--username admin --password mypassword
# Login using browser-based flow (no username/password flags)
px pxb login
# Login with username and password
px pxb login --username admin --password mypassword
Logout
# Logout and clear stored token
px pxb logout
# Logout and also clear environment variables
px pxb logout --clear-env
Flags for commands and sub-commands
Login Flags
| Flag | Short | Type | Description |
|---|---|---|---|
--server | -s | string | Auth server endpoint (e.g., https://host:port). If omitted, uses pxcentral_auth_url from config |
--username | -u | string | Username for direct (non-browser) login |
--password | -p | string | Password for direct (non-browser) login |
Logout Flags
| Flag | Short | Type | Description |
|---|---|---|---|
--clear-env | bool | Also clear environment variables (OIDC_AUTH_TOKEN, PXB_GRPC_ENDPOINT) |
Notes
- Login
- Reads defaults from
~/.pxb/config(auth URL, client ID). If the config is missing, uses sensible defaults;--serveris required when no auth URL is configured. - Username/password provided: uses password grant and saves the access token to config with the expiry provided by the server.
- Without username/password: launches a browser-based OAuth2 flow (redirect server on port 8000), then saves the token and expiry to config.
- Token and expiry are stored in
~/.pxb/config; a success message includes remaining time until expiry.
- Reads defaults from
- Logout
- Clears the authentication token from
~/.pxb/config. - Removes the legacy token file if present (located at
~/.pwx/px_backup_token). - If
--clear-envis set, unsetsOIDC_AUTH_TOKENandPXB_GRPC_ENDPOINTenvironment variables.
- Clears the authentication token from
Output Format Support
- Not applicable: these commands print human-readable messages;
--outputis not supported for login/logout.
Authentication and Context
- After a successful login, the token and expiry are persisted to
~/.pxb/configand are used by other px pxb commands. - After logout, authentication-dependent commands will require a new login to proceed.
- For configuring endpoints and defaults used by login (e.g., pxcentral_auth_url), see the Config guide: config.md