login
Command: vlt login
Use the login
command to authenticate users or machines with HCP Vault
Secrets.
The default functionality is to open a web browser and manage authentication through the user's HCP account. Alternatively, you can set the HCP service principal key pair (client ID and secret ID) as an environment variable to perform headless login.
HCP_CLIENT_ID
- set the value to your service principal client IDHCP_CLIENT_SECRET
- set the value to your service principal client secret
Examples
By default, login will launch a web browser to perform HCP login.
$ vlt login
Failed to read cache from file: failed to read file from user's credential path: open /Users/student/.config/hcp/credentials.json: no such file or directory
Failed to read cache from file: failed to read file from user's credential path: open /Users/student/.config/hcp/credentials.json: no such file or directory
No credentials found, proceeding with browser login.
The default web browser has been opened at https://auth.idp.hashicorp.com/oauth2/auth. Please continue the login in the web browser.
Success!
Successfully logged in
You may close the browser and return to the command line.
Tip
First, it looks for the credentials.json
file to see if there is cached
credentials. If not, it will launch a web browser.
Alternatively, you can preset the client ID and client secret environment variables.
$ export HCP_CLIENT_ID="<MY_CLIENT_ID>"
$ export HCP_CLIENT_SECRET="<MY_CLIENT_SECRET>"
And the, run the login
command.
$ vlt login
Successfully logged in