<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Prisma Cloud API returning 401 Unauthorized in Prisma Cloud Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527021#M882</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Although the HTTP standard specifies "unauthorized", the response can also potentially mean "unauthenticated" which means the client needs to authenticate itself to get the requested response. Can you please make sure you are authenticated before you call the API?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2023 22:11:45 GMT</pubDate>
    <dc:creator>kfirdaus</dc:creator>
    <dc:date>2023-01-13T22:11:45Z</dc:date>
    <item>
      <title>Prisma Cloud API returning 401 Unauthorized</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/526971#M880</link>
      <description>&lt;P&gt;I am trying to retrieve some scans and am receiving a 401 error.&amp;nbsp; The access key has the System Admin role.&amp;nbsp; Suggestions?&amp;nbsp; Thank you.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;API="&lt;A href="https://us-east1.cloud.twistlock.com/us-2-XXXXXXXXX" target="_blank"&gt;https://us-east1.cloud.twistlock.com/us-2-XXXXXXXXX&lt;/A&gt;"&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;# Get Token&lt;BR /&gt;JWT="$(curl -s ${API}/api/v22.06/authenticate -X POST -H 'Content-Type: application/json' \&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-d '{"username":"MyAccessKeyID","password":"MySecretKey"}' | jq '.["token"]' | tr -d '"' )"&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;# Create header with token&lt;BR /&gt;HEADER="Authorization: Bearer ${JWT}"&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;RESPONSE="$(curl -i ${API}/api/v22.06/scans -i -H '${HEADER}' -H 'content-type: application/json; charset=UTF-8' )"&lt;BR /&gt;echo $RESPONSE&lt;/P&gt;
&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 15:12:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/526971#M880</guid>
      <dc:creator>willelmes</dc:creator>
      <dc:date>2023-01-13T15:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Prisma Cloud API returning 401 Unauthorized</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527021#M882</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Although the HTTP standard specifies "unauthorized", the response can also potentially mean "unauthenticated" which means the client needs to authenticate itself to get the requested response. Can you please make sure you are authenticated before you call the API?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 22:11:45 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527021#M882</guid>
      <dc:creator>kfirdaus</dc:creator>
      <dc:date>2023-01-13T22:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Prisma Cloud API returning 401 Unauthorized</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527029#M883</link>
      <description>&lt;P&gt;I am passing in a token in one of my headers. "&lt;SPAN&gt;-H '${HEADER}'"&amp;nbsp;&lt;/SPAN&gt; I believe this is all I need for authentication.&amp;nbsp; Am I incorrect in assuming this?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 22:48:56 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527029#M883</guid>
      <dc:creator>willelmes</dc:creator>
      <dc:date>2023-01-13T22:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Prisma Cloud API returning 401 Unauthorized</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527376#M885</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Thanks for reaching out.&amp;nbsp;&lt;SPAN&gt;Can you please try to regenerate your token and r&lt;/SPAN&gt;&lt;SPAN&gt;etry API call? Please let me know if you receive the same error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 14:11:25 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/527376#M885</guid>
      <dc:creator>kfirdaus</dc:creator>
      <dc:date>2023-01-17T14:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Prisma Cloud API returning 401 Unauthorized</title>
      <link>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/528003#M887</link>
      <description>&lt;P&gt;Although you are getting a 401, maybe this might help someone else,&amp;nbsp; check your connectivity with the ping api...&lt;/P&gt;
&lt;P&gt;curl -k \&lt;BR /&gt;-s \&lt;BR /&gt;-o /dev/null \&lt;BR /&gt;-w "%{http_code}\n" \&lt;BR /&gt;-X GET \&lt;BR /&gt;&lt;A href="https://&amp;lt;CONSOLE&amp;gt;:8083/api/v1/_ping" target="_blank"&gt;https://&amp;lt;CONSOLE&amp;gt;:8083/api/v1/_ping&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;once you get a 200 then signon...&lt;/P&gt;
&lt;P&gt;######### Prisma Cloud SignOn ################&lt;BR /&gt;curl --request POST \&lt;BR /&gt;--url &lt;A href="https://api.prismacloud.io/login" target="_blank"&gt;https://api.prismacloud.io/login&lt;/A&gt; \&lt;BR /&gt;--header 'accept: application/json; charset=UTF-8' \&lt;BR /&gt;--header 'content-type: application/json; charset=UTF-8' \&lt;BR /&gt;--data "{\"username\":\"${PRISMA_KEY_ID}\",\"password\":\"${PRISMA_SECRET}\",\"customerName\":\"Citrusoft\"}"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;############ Prisma Cloud Compute SignOn #################&lt;BR /&gt;curl -k \&lt;BR /&gt;-H "Content-Type: application/json" \&lt;BR /&gt;-X POST \&lt;BR /&gt;-d \&lt;BR /&gt;"{&lt;BR /&gt;\"username\":\"${PRISMA_KEY_ID}\",&lt;BR /&gt;\"password\":\"${PRISMA_SECRET}\"&lt;BR /&gt;}" \&lt;BR /&gt;${PRISMA_CONSOLE}/api/v1/authenticate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The response contains a token; you can assign token's value to an environment variable.&lt;/P&gt;
&lt;P&gt;export token='whatever'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then invoke an API...&lt;/P&gt;
&lt;P&gt;############ List Prisma Compliance Policies #################&lt;BR /&gt;curl -k \&lt;BR /&gt;-H 'Content-Type: application/json' \&lt;BR /&gt;-H "Authorization: Bearer $token" \&lt;BR /&gt;-X GET \&lt;BR /&gt;${PRISMA_CONSOLE}/api/v1/policies/compliance/container&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;######## List Prisma Cloud Compute Registries to be Scanned ##########&lt;/P&gt;
&lt;P&gt;curl -k \&lt;BR /&gt;-u "${PRISMA_KEY_ID}:${PGE_PRISMA_SECRET}" \&lt;BR /&gt;-H 'Content-Type: application/json' \&lt;BR /&gt;-X GET \&lt;BR /&gt;"${PRISMA_CLOUD_COMPUTE_CONSOLE_API_ADDR}/api/v22.06/registry/names"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;notice that i did not use the token in that last command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope that helps.&lt;/P&gt;
&lt;P&gt;good luck!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 19:23:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/prisma-cloud-discussions/prisma-cloud-api-returning-401-unauthorized/m-p/528003#M887</guid>
      <dc:creator>TommyHunt</dc:creator>
      <dc:date>2023-01-20T19:23:51Z</dc:date>
    </item>
  </channel>
</rss>

