<?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: Issue using Auth Token within a bash script in Security</title>
    <link>https://community.splunk.com/t5/Security/Issue-using-Auth-Token-within-a-bash-script/m-p/643704#M16972</link>
    <description>&lt;P&gt;Another Detail - If I replace the token with username:password, the script can retrieve the search results using the sid.&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2023 22:45:08 GMT</pubDate>
    <dc:creator>calvinmcelroy</dc:creator>
    <dc:date>2023-05-17T22:45:08Z</dc:date>
    <item>
      <title>Issue using Auth Token within a bash script</title>
      <link>https://community.splunk.com/t5/Security/Issue-using-Auth-Token-within-a-bash-script/m-p/643702#M16971</link>
      <description>&lt;P&gt;I am trying to work through an issue and cannot seem to find a answer. I need to create a bash script that uses an auth token to make calls to the Splunk Rest API. The script will be used by a custom app that is located on a searchhead (linux). Token Authentication has been enabled, and I can verify that the Token is enabled and valid.&amp;nbsp; I can use the Token to make ad-hoc Rest API requests via the terminal local to the searchhead. If I try to use it within the script I am seeing unexpected behavior.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The token seems to be able to make certain API calls in the script but it cannot retrieve the results of the call. An example would be I can use the token in the script to initiate a search. I will receive back the Sid of that search. If I use the same script to try to retrieve the search results using the Sid, I get back nothing. No error message, but just no output at all. If I manually re-run the same API request using the Token and the same Sid outside of the script on the terminal. It will return my search result as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have turned on debug logging for JsonWebTokenHandler and see no issue. This behavior happens if I use the bash interpreter to execute the script (./script.sh) or (/opt/splunk/etc/app/app_name/bin/script.sh). There is no difference if I execute the script with /opt/splunk/bin/splunk cmd &amp;lt;path_to_script&amp;gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I remember reading that there is something strange about the local interpreter that could be causing this, but I cannot find it again on google. Does anybody know what might be causing this behavior or how I can overcome this issue?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Searchhead is running Splunk version 8.1.2 hosted on Ubuntu.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 22:30:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Issue-using-Auth-Token-within-a-bash-script/m-p/643702#M16971</guid>
      <dc:creator>calvinmcelroy</dc:creator>
      <dc:date>2023-05-17T22:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using Auth Token within a bash script</title>
      <link>https://community.splunk.com/t5/Security/Issue-using-Auth-Token-within-a-bash-script/m-p/643704#M16972</link>
      <description>&lt;P&gt;Another Detail - If I replace the token with username:password, the script can retrieve the search results using the sid.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 22:45:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Issue-using-Auth-Token-within-a-bash-script/m-p/643704#M16972</guid>
      <dc:creator>calvinmcelroy</dc:creator>
      <dc:date>2023-05-17T22:45:08Z</dc:date>
    </item>
  </channel>
</rss>

