Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to authenticate to a on-premise Jira with REST - 401

Oli November 15, 2022 edited

I would like to create tickets in an on-premise jira server. Unfortunately, no matter what i try, i get an error.

I followed the tutorial, telling me i should use curl with -u to pass user/pass information. Thats what i did:

curl -u jira.automation:78B...4RF -X GET -H "Content-Type: application/json" 'https://servicedesk.myhost.ch:8081/rest/api/2/issue/createmeta'

that returns some html, where it states:  <h1>Unauthorized (401)</h1>

so i thought i try it with a token (changed the username for that)

curl -u oliver.xxx:NTk5MzY3xxxFVEbAm1 -X GET -H "Content-Type: application/json" 'https://servicedesk.myhost.ch:8081/rest/api/2/issue/createmeta'

That returned  <p>Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</p>

So i am wondering if this is a server thingen? Do i have to enable basic auth? 

1 answer

1 accepted

0 votes
Answer accepted
Florian Bonniec
Community Champion
November 15, 2022

Hi @Oli 

If you want to create something you will need to use POST instead of GET.

curl -u admin:admin -X POST  -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/

 

https://docs.atlassian.com/software/jira/docs/api/REST/9.4.0/#api/2/issue-createIssue

 

DOes it work if you try with your credential instead the  jira.automation one ?

 

Regards

Oli November 15, 2022

my bad, guess i made that mistake while trying out some different things to at least get past the authentication.

 

i tried it with

curl -u jira.automation:thePasswordOfTheUser -X POST -H "Content-Type: application/json" 'https://servicedesk.xxx.ch:8081/rest/api/2/issue' which got me a 401

curl -u oliver.myself:NTk5MzY3O...M25WDFVEbAm1 -X POST -H "Content-Type: application/json" 'https://servicedesk.obvita.ch:8081/rest/api/2/issue' and got a 403

i changed it to a GET because i thought its maybe easier to use a regular GET on a very simple endpoint like https://servicedesk.xxx.ch:8081/rest/api/2/issue/createmeta, but also here, same behaviour

Oli November 16, 2022

i just visited 'https://servicedesk.xxx.ch:8081/rest/api/2' with a private browser window and noticed, that it requests me for microsoft credentials, yay, i guess the problem is that there is some kind of single sign on implemented. have to check that out with my admin and google if someone else tried to get that working. worst case would be to have like 2 logins, one for the intranet/SSO and one for jira

Oli November 16, 2022

so my user is not able to curl the endpoint with the token, but with my password it worked. the jira.automation user is not jira.automation but jautomation, with that it works. so it was a layer 8 communication problem ;)

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events