How to authenticate to Jira REST API with curl

Christoph_Klocker February 27, 2020

I read through several guides, however nothing seems to work.

I'd like to simply update my jira tickets status through a github hook.
The REST examples won't work as the server responds with

`Basic auth with password is not allowed on this instance`

I tried different ways, created an API token for my user. Nothing works. Tried even setting it as `Authorization: Bearer XXXXX`, didn't work either.

 

How do I get the correct token and how do I use it with `curl`

2 answers

5 votes
Christoph_Klocker February 27, 2020

To Answer my own question after figuring it out.

Get an API token

https://id.atlassian.com/manage-profile/profile-and-visibility 
Create a Base64 encoded token from your email and api token

echo -n EMAIL:API_TOKEN | base64

use it in "Authorization: Basic TOKEN" header


curl -D- \
-X GET \
-H "Authorization: Basic TOKEN" \
-H "Content-Type: application/json" \
"https://DOMAIN.atlassian.net/rest/api/2/issue/ISSUE"
Vinod Kotiya January 31, 2023

This is the correct answer. I used this to connect on power bi. I used online tool to get the base64 token and used header you have mentioned.

Kudos to you.

1 vote
Per Löfgren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2020

Use email and token. You can get your token on https://id.atlassian.com/manage-profile/profile-and-visibility 

Username should be mail and password should be token

Christoph_Klocker February 27, 2020

That's Basic Auth and unfortunately not working with the message above.

Like Abhijeet Singh likes this

Suggest an answer

Log in or Sign up to answer