I'm trying to fetch a user from the TrueVault API using curl.
I've been using the following curl command (as per the documentation):
curl https://api.truevault.com/v2/users/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx7ce \
-X GET \
-u API_KEY:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx461"
The credentials:
user_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx7ce
api key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx461
Every time I send the request I'm getting an error:
"error": {
"code": "AUTH.UNSUCCESSFUL",
"message": "Authentication Failure.",
"type": "invalid_request_error"
},
"result": "error",
"transaction_id": "xxxxxxxx-xxxx-xxxx-xxxx-3ba883e31f99"
So I wanted to check if maybe I'm doing wrong or might be something else.
This user has all permissions (Create, Read, Update, Delete).
It looks like your Auth Header is malformed. You can read more about how to build the Auth Header here: https://docs.truevault.com/overview#authentication.
For a simple curl you can use the -u
option instead of building the base64 Basic Auth header. -u
expects username:password
, but TrueVault's API is token-based so they want you to do "$API_KEY:". Note the empty second component! That trailing :
is critical.
Try this:
curl https://api.truevault.com/v2/users/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx7ce \
-X GET \
-u "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx461:"