Token Authentication and Token Hierarchy
You'll learn how Vault organizes tokens into different types and privilege levels to control access and manage secrets securely.
What Are Vault Tokens?
In HashiCorp Vault, tokens are the fundamental authentication mechanism — they're like temporary access passes that clients use to interact with Vault. Every action in Vault requires a token, and different token types serve different purposes with varying capabilities and lifecycles.
Token Types and Hierarchy
Root Tokens
Root tokens sit at the top of the hierarchy with complete, unrestricted access to Vault. Think of them as the master key. They're created during initialization and should be used sparingly — typically only for emergency recovery or initial setup. Root tokens don't expire and can't be revoked through normal means, making them powerful but dangerous if compromised.
Service Tokens
Service tokens are the standard, persistent tokens used by applications and users. They have a defined TTL (time-to-live), can have child tokens, and support renewal. When a service token creates another token, the child inherits from the parent — if you revoke the parent, all children are automatically revoked too. This creates a tree-like hierarchy.
Batch Tokens
Batch tokens are lightweight, ephemeral tokens designed for high-volume, short-lived operations. Unlike service tokens, they can't be renewed, don't support child tokens, and don't appear in token lookups. They're perfect for distributed systems where you need millions of temporary credentials without overwhelming Vault's storage.
Token Lifecycle Management
Tokens progress through creation, usage, renewal (if supported), and eventual expiration or revocation. Vault tracks token ancestry, lease durations, and associated policies. Proper lifecycle management means rotating tokens regularly, revoking unused tokens, and using the least-privileged token type for each use case.
Key Takeaway: Vault's token hierarchy — root, service, and batch — provides granular control over authentication, with service tokens offering flexibility through parent-child relationships and batch tokens enabling high-scale, short-lived access patterns.