Cannot Access API with Access Key

Reply
Highlighted
L0 Member

Cannot Access API with Access Key

I am trying to get the API to work so we can properly deploy host defenders on our non-container hosts.  I cannot authenticate to the API and I am at wit's end.  I supply the access key id and secret key value and get back the following:
{"err":"unauthorized access key 123...}
 
This doesn't make sense to me, i've tried with both access keys created using sys admin role and cloud provisioning role, nothing works.  Please let me know if you know what might be wrong... are keys not readily usable upon creation?
 
This is the curl command I am sending (with private things redacted):
curl -H "Content-Type: application/json" \
-d '{"username":"123...","password":"abc...."}' \
https://us-west1.cloud.twistlock.com/us-3-123456789/api/v1/authenticate
Highlighted
L0 Member

Hi @BCerier 

I also had some problems with this when I started automating Prisma.
Here you can find the API documentation: https://api.docs.prismacloud.io/reference#try-the-apis

 

I see the following problems in your request:

1. The API URI is not correct, you can find the correct one on the link above

2. You have to use URI/login not authenticate

3. You need to place a POST request: curl -X POST

 

I hope this helps you.

Highlighted
L0 Member

Hi @SMeury 

 

thanks for your response.  Maybe we are thinking of two different apis? I am aware of that API endpoint, but that is for Prisma Cloud (Redlock) and I am specifically looking for API calls to the compute section (what used to be Twistlock).  I need to be able to authenticate with twistlock to get a token to then download an install script to deploy single host defenders when machines start up.

 

I was just able to figure it out however, my command that I was trying was correct, however the access key i had did not have a role assigned to it within the Prisma Cloud->Compute->Manage->Authentication section.  After updating the role in there the access key worked as expected in the curl command that I originally posted.

Highlighted
L2 Linker

Hi,

It looks like a piece of the string is missing. Please try "https://us-west1.cloud.twistlock.com/us-3-123456789/api/v1/authenticate-client"

Respectfully,
Patrick
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!