<?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 Is anyone succesful in using API access with SAML authentication? in Endpoint Privilege Manager (EPM) Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312463#M1044</link>
    <description>&lt;P&gt;We user the SaaS version of cyberark EPM; I found discussion &lt;A alt="https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance" href="https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance" target="_blank"&gt;https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance&lt;/A&gt;&amp;nbsp; and other saying more or less the same thing, but we're unable to get it working.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I extract the token (either with the New-SAMLInteractive powershell module or by sniffing the session on an F12 panel on my browser)&lt;/LI&gt;&lt;LI&gt;I verify the token: it is a base64-encoded XML that contains all the details from my ID Provider (Okta)&lt;/LI&gt;&lt;LI&gt;I try to use it in:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;$url="https://it.epm.cyberark.com/SAML/Logon";&lt;/P&gt;&lt;P&gt;$ch=curl_init($url);&lt;/P&gt;&lt;P&gt;curl_setopt($ch,CURLOPT_POSTFIELDS,"SAMLResponse=" . urlencode($token1));&lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); &lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);&lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_VERBOSE, true);&lt;/P&gt;&lt;P&gt;$result = curl_exec($ch);&lt;/P&gt;&lt;P&gt;curl_close($ch);&lt;/P&gt;&lt;P&gt;print_r($result);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I always get &lt;/P&gt;&lt;P&gt;{"StatusCode":401,"Error":"Authentication is required and has failed or has not yet been provided"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2024 08:18:26 GMT</pubDate>
    <dc:creator>rpiola</dc:creator>
    <dc:date>2024-08-30T08:18:26Z</dc:date>
    <item>
      <title>Is anyone succesful in using API access with SAML authentication?</title>
      <link>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312463#M1044</link>
      <description>&lt;P&gt;We user the SaaS version of cyberark EPM; I found discussion &lt;A alt="https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance" href="https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance" target="_blank"&gt;https://community.cyberark.com/s/question/0D52J000097AzDWSA0/how-can-we-use-saml-authentication-to-make-an-api-call-to-our-saas-epm-instance&lt;/A&gt;&amp;nbsp; and other saying more or less the same thing, but we're unable to get it working.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I extract the token (either with the New-SAMLInteractive powershell module or by sniffing the session on an F12 panel on my browser)&lt;/LI&gt;&lt;LI&gt;I verify the token: it is a base64-encoded XML that contains all the details from my ID Provider (Okta)&lt;/LI&gt;&lt;LI&gt;I try to use it in:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;$url="https://it.epm.cyberark.com/SAML/Logon";&lt;/P&gt;&lt;P&gt;$ch=curl_init($url);&lt;/P&gt;&lt;P&gt;curl_setopt($ch,CURLOPT_POSTFIELDS,"SAMLResponse=" . urlencode($token1));&lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); &lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);&lt;/P&gt;&lt;P&gt;curl_setopt($ch, CURLOPT_VERBOSE, true);&lt;/P&gt;&lt;P&gt;$result = curl_exec($ch);&lt;/P&gt;&lt;P&gt;curl_close($ch);&lt;/P&gt;&lt;P&gt;print_r($result);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I always get &lt;/P&gt;&lt;P&gt;{"StatusCode":401,"Error":"Authentication is required and has failed or has not yet been provided"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 08:18:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312463#M1044</guid>
      <dc:creator>rpiola</dc:creator>
      <dc:date>2024-08-30T08:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Is anyone succesful in using API access with SAML authentication?</title>
      <link>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312464#M1045</link>
      <description>&lt;P&gt;I guess to get the IDP token you should use the URL that point to your IDP server. You can find it from EPM console Administration &amp;gt; SAML Integration page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Field_Content_versions_oct20__068Ht00000Ve5VIIAZ.png"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/89685iD4293DAA3BCA6451/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field_Content_versions_oct20__068Ht00000Ve5VIIAZ.png" alt="Field_Content_versions_oct20__068Ht00000Ve5VIIAZ.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 13:18:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312464#M1045</guid>
      <dc:creator>Magesh</dc:creator>
      <dc:date>2024-08-30T13:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is anyone succesful in using API access with SAML authentication?</title>
      <link>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312465#M1046</link>
      <description>&lt;P&gt;It worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was missing the fact that I need to use the URL provided by Cyberark, and I was using the LoginURL provided by the IdP for Idp-Initiated sessions .&lt;/P&gt;&lt;P&gt;I repeated everything starting from the url found on the SAML integration, and I used the sample script that I found in powershell:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Import-Module -name .\PS-SAML-Interactive.psm1&lt;/P&gt;&lt;P&gt;$LoginURL = 'https://eu.epm.cyberark.com/SAML/XXXXX' &lt;/P&gt;&lt;P&gt;$SAMLResponse = New-SAMLInteractive -LoginIDP $loginURL&lt;/P&gt;&lt;P&gt;$DispatcherURL = "&lt;A alt="https://login.epm.cyberark.com/SAML/Logon" href="https://login.epm.cyberark.com/SAML/Logon" target="_blank"&gt;https://eu.epm.cyberark.com/SAML/Logon&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;$Method = "POST"&lt;/P&gt;&lt;P&gt;$Headers = @{"Content-Type" = "application/x-www-form-urlencoded"}&lt;/P&gt;&lt;P&gt;$SAMLAuthBody = @{SAMLResponse= "$SAMLResponse"}&lt;/P&gt;&lt;P&gt;$SAMLAuthResponse = Invoke-RestMethod -Uri $DispatcherURL -Method $Method -Headers $Headers -Body $SAMLAuthBody&lt;/P&gt;&lt;P&gt;$SAMLAuthResponse&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now I'll revert to my PHP Scripts. thank you&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 13:42:04 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/endpoint-privilege-manager-epm/is-anyone-succesful-in-using-api-access-with-saml-authentication/m-p/1312465#M1046</guid>
      <dc:creator>rpiola</dc:creator>
      <dc:date>2024-08-30T13:42:04Z</dc:date>
    </item>
  </channel>
</rss>

