Testing token authentication from the command line

After you set up token authentication, you can perform basic testing using a REST client and cURL. The JSON JavaScript Object Notation (JSON) you appear within a text file:

{
   "client_id":"MyRegisteredClientName",
   "username":"admin",
   "password":"MyPassw0rd!",
   "scope":"certificate:manage,approve"
}

Assuming the above content is stored in a file called auth.txt and tpp.venafi.example is the Trust Protection Platform host, the command line syntax for using cURL is shown below. A successful response includes an access_token and expires values.

C:>curl -k -i -H "Content-Type: application/json" --data-binary @auth.txt -l \
https://tpp.venafi.example/vedauth/Authorize/Oauth


HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server:
Access-Control-Allow-Origin: *
X-UA-Compatible: IE=Edge
X-Frame-Options: SAMEORIGIN
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
Date: Tue, 17 Aug 2021 15:00:43 GMT
Content-Length: 273

{"access_token":"jH9CRw7u...==","refresh_token":"TUIowBYJ...==","expires_in":7775999,"expires":1636988444,"token_type":"Bearer","scope":"certificate:approve,manage","identity":"local:{f28e804a-fcf2-4ec6-bf7e-2d2db92ff00f}","refresh_until":1660748444}