Quantcast
Channel: Questions in topic: "splunk-enterprise"
Viewing all articles
Browse latest Browse all 47296

SpunkJS using client side sdk Authentication failed

$
0
0
I've been following the Splunk documentation on how to use the client sdk. I've created an express js application by using a generator. I'm planning on using the REST API on the website I'm hosting, but I cannot authenticate using proxy. I also tried `jQueryHttp()`, but it just gave me an ERR_INSECURE_RESPONSE. **I keep getting this error:** Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/proxy/services/auth/login?output_mode=json Why is my **host changing to localhost:3000** when **I changed it to be splunkserver:8089?** I'm running my express application on port 3000, and I'm accessing Splunk remotely. I'm using node js and I've set the Javascript SDK as a static file with express. If I have to set up a proxy, how would I do that using node? I didn't see any documentation on it. When O ran the SDK examples using nodejs, I got it to work. I read a lot of answers and they pointed to using a proxy, but I have never seen how to set that up on the server side. Heres my code: var done = callback = function(err) { console.log(err); }; var Async = splunkjs.Async; var http = new splunkjs.ProxyHttp("/proxy"); var service = new splunkjs.Service(http, { username: "", password: "", scheme: "https", host: "", port: 8089, version: 5.0 }); console.log(service); service.login(function(err, success) { // We check for both errors in the connection as well // as if the login itself failed. if (err || !success) { console.log("Login failure. Please check your server hostname and authentication credentials."); done(err || "Login failed"); return; } // Now that we're logged in, let's get a listing of all the apps. service.apps().fetch(function(err, apps) { if (err) { console.log("There was an error retrieving the list of applications:", err); done(err); return; } var appsList = apps.list(); console.log("Applications:"); for(var i = 0; i < appsList.length; i++) { var app = appsList[i]; console.log(" App " + i + ": " + app.name); } done(); }); });

Viewing all articles
Browse latest Browse all 47296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>