To view information about a token, the command vault token lookup can be used on the CLI. This command will display lots of information and metadata associated with a particular token. This information includes TTL, number of uses, type of token, policies, and more.
There are two different ways you can use the vault token lookup command. If you are logged into Vault and want to check the current token being used, you can just use vault token lookup. If you want to check a different token, you can use vault token lookup <token>. You can also use -accessor flag if you only know the accessor and not the token.
- $ vault token lookup s.DjWW03Jn6i4RFhFngUPu8nYB
- Key Value
- --- -----
- accessor yQbBeuJIvDPdf38v5lWAcxXN
- creation_time 1633796417
- creation_ttl 768h
- display_name token
- entity_id n/a
- expire_time 2021-11-10T11:20:17.5104784-05:00
- explicit_max_ttl 0s
- id s.DjWW03Jn6i4RFhFngUPu8nYB
- issue_time 2021-10-09T12:20:17.5104784-04:00
- meta <nil>
- num_uses 0
- orphan false
- path auth/token/create
- policies [default training]
- renewable true
- ttl 767h59m37s
- type service
Incorrect Answers:
vault operator diagnose is a new command in Vault 1.8 that allows you to troubleshoot a Vault node where the Vault service will not start.
vault policy list will list the current policies on the Vault node/cluster. It does not show what tokens are associated with each policy.
vault token capabilities will list the capabilities on a certain path for the referenced token. You provide the token and the path you want to check and Vault will return a list of capabilities (list, read, create, etc) that is permitted on the referenced path.