POST /tokens
Create a token for the authenticated user. Doesn't allow certificate authentication.
Request format
When Forming RBAC API requests to this endpoint, the content type
is application/json
. The body can be a JSON object
identifying token settings, such as the lifetime
or
label
. For descriptions of keys, refer to Tokens endpoints keys.
For example:
curl -X POST "https://$(puppet config print server):4433/rbac-api/v1/tokens" \ -H "X-Authentication:$(puppet-access show)" \ -H "Content-type: application/json" \ -d '{"lifetime": "1y", "description": "A token to be used with joy and care.", "client": "PE console"}'
Response format
If the supplied authentication is valid, not expired, and the attached user is not revoked, the endpoint returns 200 OK and the new token, such as:
{"token":"0QX-WR3kgP0R9C2dA0I2nfnp0QgAT95_xH3iylBhqroA"}
Error responses are similar to the POST /auth/token error responses.