HashiCorp Cloud Platform
HCP Vault Radar API authentication
Overview
The HCP Vault Radar API uses the HCP authentication mechanism.
Authentication
The HCP API requires an access token to authorize the request.
Generate the access key with your HCP client ID and secret.
$ curl --location "https://auth.idp.hashicorp.com/oauth2/token" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "client_id=$HCP_CLIENT_ID" \ --data-urlencode "client_secret=$HCP_CLIENT_SECRET" \ --data-urlencode "grant_type=client_credentials" \ --data-urlencode "audience=https://api.hashicorp.cloud"In the following example response, the bearer access token is valid for one hour:
{ "access_token": "eyJhbGciOiJSUzI1NiIsInR...", "expires_in": 3600, "token_type": "Bearer" }Set the
HCP_ACCESS_TOKENenvironment variable to the access token. This action makes it easier to reference the token when you are interacting with the API.$ export HCP_ACCESS_TOKEN=<access-token>
Refer to the HashiCorp Cloud Platform authentication documentation for more information.