<?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: 401 Unauthorized - REST API using GuzzleHttp in Security</title>
    <link>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313349#M12816</link>
    <description>&lt;P&gt;I found I was getting unauthorised using the 'admin' user but when I created my own with its own group giving it (admin, can_delete, power, splunk-system-role, user) privilages... I was able to get results using that... for example I created user bob then this worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.\curl.exe -u bob:bob -k &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches" target="test_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;,I found I was getting unauthorised using the 'admin' user but when I created my own with its own group giving it (admin, can_delete, power, splunk-system-role, user) privilages... I was able to get results using that... for example I created user bob then this worked.&lt;/P&gt;

&lt;P&gt;.\curl.exe -u bob:bob -k &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches"&gt;https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2017 13:10:06 GMT</pubDate>
    <dc:creator>yorkshireandrew</dc:creator>
    <dc:date>2017-12-21T13:10:06Z</dc:date>
    <item>
      <title>401 Unauthorized - REST API using GuzzleHttp</title>
      <link>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313348#M12815</link>
      <description>&lt;P&gt;I am using GuzzleHttp&lt;/P&gt;

&lt;P&gt;Login call " services/auth/login " works fine and I get the session token as well.&lt;/P&gt;

&lt;P&gt;but after this each call give me following error &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Client error: &lt;CODE&gt;POST &lt;A href="https://myip:8089/services/search/jobs" target="test_blank"&gt;https://myip:8089/services/search/jobs&lt;/A&gt;&lt;/CODE&gt; resulted in a &lt;CODE&gt;401 Unauthorized&lt;/CODE&gt; response: Unauthorized&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;here is my code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$host= "https://myip:8089/services/search/jobs";
$request = new \GuzzleHttp\Psr7\Request('POST', $host, [ 'headers' =&amp;gt; ['Authorization' =&amp;gt; 'Splunk xxxxxxxxxxxxxxxxxxxx',
                                                         'Content-Type' =&amp;gt; 'application/x-www-form-urlencoded']]);
$response = $client-&amp;gt;send($request, [   'verify' =&amp;gt; false,
                                        'form_params' =&amp;gt;   ["search" =&amp;gt; 'search index="asm_live" sourcetype=syslog OR sourcetype=syslog_f5asm attack_type attack_type="*" ip_client="*" | stats count']
                                    ]);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am running in circles and unable to figure out the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 12:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313348#M12815</guid>
      <dc:creator>sandyapps</dc:creator>
      <dc:date>2017-11-28T12:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: 401 Unauthorized - REST API using GuzzleHttp</title>
      <link>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313349#M12816</link>
      <description>&lt;P&gt;I found I was getting unauthorised using the 'admin' user but when I created my own with its own group giving it (admin, can_delete, power, splunk-system-role, user) privilages... I was able to get results using that... for example I created user bob then this worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.\curl.exe -u bob:bob -k &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches" target="test_blank"&gt;https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;,I found I was getting unauthorised using the 'admin' user but when I created my own with its own group giving it (admin, can_delete, power, splunk-system-role, user) privilages... I was able to get results using that... for example I created user bob then this worked.&lt;/P&gt;

&lt;P&gt;.\curl.exe -u bob:bob -k &lt;A href="https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches"&gt;https://127.0.0.1:8089/servicesNS/nobody/search/saved/searches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 13:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313349#M12816</guid>
      <dc:creator>yorkshireandrew</dc:creator>
      <dc:date>2017-12-21T13:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: 401 Unauthorized - REST API using GuzzleHttp</title>
      <link>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313350#M12817</link>
      <description>&lt;P&gt;Thank you for your Answer.&lt;/P&gt;

&lt;P&gt;Actually I never found a solution for this, we had to use  php SDK given by Splunk&lt;/P&gt;

&lt;P&gt;its works like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2017 13:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/401-Unauthorized-REST-API-using-GuzzleHttp/m-p/313350#M12817</guid>
      <dc:creator>sandyapps</dc:creator>
      <dc:date>2017-12-21T13:17:50Z</dc:date>
    </item>
  </channel>
</rss>

