Skip to main content
Learn how to authenticate to HashiCorp Vault using the CLI with various methods—Okta, AppRole, Userpass, token, and more. Follow these steps to obtain a Vault token and perform operations without re-entering credentials.

Auth Methods Overview


1. Okta Authentication with Vault CLI

To log in using Okta, run:
After entering your password, you’ll see:
Vault stores this token in the helper file ($HOME/.vault-token on Linux/macOS or C:\Users\<User>\.vault-token on Windows). You can verify it with:

2. Performing Vault Operations

Once authenticated, you can enable or disable auth methods, list policies, and perform other Vault operations without re-entering credentials:

3. AppRole Authentication

AppRole requires both a Role ID and a Secret ID. Use this method for machine-to-machine authentication:
You’ll receive a token and metadata in a similar table format.
Keep your secret_id secure and rotate it regularly. Do not commit your credentials to version control.

4. Userpass Authentication

For the built-in Userpass method, provide your username and password:
Vault issues a token and stores it in the helper file for future CLI commands.

5. Direct Token Login

If you already have a valid Vault token, you can log in directly:
Future commands will use this token automatically. You can then enable another auth method, for example Azure:

Next Steps & References

You now have a solid understanding of using various authentication methods with the Vault CLI.

Watch Video