Security

How to get OAuth Token- using Curl command

mmoayed
New Member

Hi, I want to get back Token id from the Curl command below :


curl -k -u UserName:Password -X POST https://0.0.0.0:8089/services/authorization/tokens

But , I am  getting back :

<?xml version="1.0" encoding="UTF-8"?>
<response>
<messages>
<msg type="ERROR">Unauthorized</msg>
</messages>
</response>

 

Can anyone help how to resolve this case , what is missing in Curl command or what is wrong ?

 

Labels (2)
0 Karma

Velluv
Loves-to-Learn Lots

Ok,  then You should double check that You are using correct username:password combination  and that the user has Admin role

0 Karma

mmoayed
New Member

Well, I think that was related to the policy from Admin that not to use userName and Password and to use the token instead.

 

0 Karma

Velluv
Loves-to-Learn Lots

Hi, use GET instead of POST

curl -k -u <username>:<password> -X GET https://<server>:<management_port>/services/authorization/tokens

https://docs.splunk.com/Documentation/SplunkCloud/8.2.2203/Security/ManageAuthTokens#Manage_authenti... 

0 Karma

mmoayed
New Member

Thank you for your reply , but I still having same :

└──> curl -k -u UserName:PassWord -X GET https://0.0.0.0:8089/services/authorization/tokens
<?xml version="1.0" encoding="UTF-8"?>
<response>
<messages>
<msg type="ERROR">Unauthorized</msg>
</messages>
</response>

0 Karma

Velluv
Loves-to-Learn Lots

Ok,  then You should double check that You are using correct username:password combination  and that the user has Admin role

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...