Getting Data In

Why do I receive REST API "login failed" message?

nsshey
Explorer

I ran the following command:

curl -k https://hosthere:8089/services/auth/login -d username=admin -d password=password

and got a weird error, so I tried it in my browser:

https://hosthere:8089/services/auth/login

and got this error:

<response>
<messages>
<msg type="WARN">Login failed</msg>
</messages>
</response>

I don't understand why I am getting this if I didn't even see the pop-up that asks me for login information. Sometimes my browser allows me to enter my login info, and then API works, and sometimes it doesn't. I checked and my pop-ups are enabled for this site.

Any suggestions?

Tags (3)
0 Karma

nnmiller
SplunkTrust
SplunkTrust

Reviewing the REST API Reference, it appears that the tutorial docs are incorrect.

Per auth/login REST API docs section, the correct command here is (yes, enter username/pass 2x):

curl -k -u admin:changeme  https://localhost:8089/services/auth/login -d username=admin -d password=changeme

Which returns an XML response with a session key:

<response>
    <sessionKey>192fd3e46a31246da7ea7f109e7f95fd</sessionKey>
</response>
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi nsshey,

You should provide user login information with your curl command:

 curl -k -u admin:changeme https://hosthere:8089/services/auth/login ....

See the docs for more details http://docs.splunk.com/Documentation/Splunk/6.5.0/RESTTUT/RESTbasicexamples

Hope this helps ...

cheers, MuS

0 Karma

rjthibod
Champion

Go to the access controls menu as an Admin and make sure your role has the following capabilities.

rest_apps_view
rest_properties_get
rest_properties_set
rest_apps_management

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...