vault login
Authenticate to Vault and target a specific Vault instance.
vault login
Section link for vault loginAuthenticate to a Vault and make it the active Vault. Without credential flags, opens a browser window to log in. With --access-token, --session-id, or --password, authenticates directly without a browser.
If the login resolves to a username already stored at the same scope, it replaces that user's stored credentials.
Logins are stored under your Vault username. The CLI stores one session per username and keeps one user active at a time. By default, a login is kept for the current shell only. Use --scope global to save it for every shell on this computer. In an interactive terminal, the CLI prompts for confirmation before saving a global login, defaulting to no.
vault login [--dns <DNS>] [--username <USERNAME>] [--access-token] [--session-id] [--password] [--scope <SCOPE>]Options
Section link for Options| Option | Type | Required | Description |
|---|---|---|---|
--dns <DNS> | string | Required for --access-token, --session-id, and --password | Vault DNS (for example, myorg.veevavault.com). With browser login, skips the Vault picker |
--username <USERNAME> | string | Required for --password | Vault username. With browser login, the CLI prompts for it if omitted |
--access-token | flag | Optional | Log in with an API access token. The token is read from a hidden prompt or piped stdin |
--session-id | flag | Optional | Log in with an existing session ID. The value is read from a hidden prompt or piped stdin |
--password | flag | Optional | Log in with a username and password. The password is read from a hidden prompt or piped stdin |
--scope <SCOPE> | shell | global | Optional | Where to keep this login. shell (default) keeps it in the current shell only, including subshells and scripts started from it. global saves it for every shell on this computer, including scripts and agents started from any of them |
This command also accepts the global options.
Examples
Section link for ExamplesBrowser login (default)
Section link for Browser login (default)vault login --dns myorg.veevavault.comIf you have access to more than one Vault, the CLI shows a picker listing Vault names. Pass --dns to target a specific Vault and skip the picker.
Access token (headless)
Section link for Access token (headless)vault login --dns myorg.veevavault.com --access-tokenThe CLI prompts for the token with echo disabled.
Username & password
Section link for Username & passwordvault login --dns myorg.veevavault.com --username user@example.com --passwordThe CLI prompts for the password with echo disabled.
vault logout
Section link for vault logoutRemove a stored user's credentials and end their Vault session.
vault logout [<USERNAME>] [--all]Options
Section link for Options| Option | Type | Required | Description |
|---|---|---|---|
<USERNAME> | string | Optional | Username to log out. Default: the current user. Cannot be combined with --all |
--all | flag | Optional | Log out every stored user. Cannot be combined with <USERNAME> |
This command also accepts the global options.