<?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 Splunklib.client: request failed session is not logged in in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunklib-client-request-failed-session-is-not-logged-in/m-p/530023#M9502</link>
    <description>&lt;P&gt;Edit: I am using the correct token, it's my instance that's wrong. This instance is on my local machine for easy development. My other two servers work fine. I moved my app over to my test server, and it works fine.&lt;/P&gt;&lt;P&gt;Building my own rest handler which accesses storage_passwords. I assume I'm using the wrong token? I don't know the structure of "self" here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import splunk, base64, sys, os, time, json, re, shutil, subprocess, platform, logging, logging.handlers
from splunk.persistconn.application import PersistentServerConnectionApplication
import splunklib.client as client

class req(PersistentServerConnectionApplication):
    def __init__(self, command_line, command_arg):
        PersistentServerConnectionApplication.__init__(self)

    def handle(self, in_string):
        authtoken = json.loads(in_string)["session"]["authtoken"]
        logger.debug(authtoken)
        service = client.connect(token=authtoken)
        storage_passwords = service.storage_passwords&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hardcoding the credentials, I just get "login failed". I'm thinking this is related to my other post &lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/Credentials-not-accepted-for-port-8089/m-p/530014#M35981" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/Credentials-not-accepted-for-port-8089/m-p/530014#M35981&lt;/A&gt;. Browsing 8089, I also cannot log on with any credential.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2020 15:38:42 GMT</pubDate>
    <dc:creator>tmontney</dc:creator>
    <dc:date>2020-11-19T15:38:42Z</dc:date>
    <item>
      <title>Splunklib.client: request failed session is not logged in</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunklib-client-request-failed-session-is-not-logged-in/m-p/530023#M9502</link>
      <description>&lt;P&gt;Edit: I am using the correct token, it's my instance that's wrong. This instance is on my local machine for easy development. My other two servers work fine. I moved my app over to my test server, and it works fine.&lt;/P&gt;&lt;P&gt;Building my own rest handler which accesses storage_passwords. I assume I'm using the wrong token? I don't know the structure of "self" here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import splunk, base64, sys, os, time, json, re, shutil, subprocess, platform, logging, logging.handlers
from splunk.persistconn.application import PersistentServerConnectionApplication
import splunklib.client as client

class req(PersistentServerConnectionApplication):
    def __init__(self, command_line, command_arg):
        PersistentServerConnectionApplication.__init__(self)

    def handle(self, in_string):
        authtoken = json.loads(in_string)["session"]["authtoken"]
        logger.debug(authtoken)
        service = client.connect(token=authtoken)
        storage_passwords = service.storage_passwords&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hardcoding the credentials, I just get "login failed". I'm thinking this is related to my other post &lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/Credentials-not-accepted-for-port-8089/m-p/530014#M35981" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/Credentials-not-accepted-for-port-8089/m-p/530014#M35981&lt;/A&gt;. Browsing 8089, I also cannot log on with any credential.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 15:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunklib-client-request-failed-session-is-not-logged-in/m-p/530023#M9502</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2020-11-19T15:38:42Z</dc:date>
    </item>
  </channel>
</rss>

