In this guide, we’ll walk through how to authenticate to HashiCorp Vault via Okta and retrieve secrets usingDocumentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
curl. The same pattern applies for other auth methods (e.g., GitHub, LDAP, AWS).
Prerequisites
| Requirement | Purpose |
|---|---|
| Vault server | Running locally at http://127.0.0.1:8200 |
| curl | Issue HTTP requests |
| jq (optional) | Pretty-print JSON |
Installing
jq is optional but recommended for readable JSON outputs.1. Authenticate via Okta
First, create a JSON file namedpassword.json containing your Okta password:
you@example.com with your Okta username:
client_token in the auth block:
jq:
client_token value.
2. Read a Secret from the KV Store
With yourclient_token, you can query Vault’s KV store. In this example, we read from secret/data/app01 (KV version 2):
Never expose your
client_token in shared scripts or logs. Treat it like a password.3. Summary of Endpoints
| Endpoint | Description | HTTP Method |
|---|---|---|
| /v1/auth/okta/login/ | Authenticate via Okta | POST |
| /v1/secret/data/ | Read secret from KV v2 | GET |
Conclusion
You have now:- Authenticated to Vault using the Okta auth method.
- Extracted the
client_tokenfrom the API response. - Retrieved a secret from the KV secrets engine.