API Token Basic Authentication

Andy Baird
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 13, 2020

I'm attempting to use the REST API using Basic Authentication with one of my JIRA account's API tokens, however all calls respond with a 401.

Here's an example CURL request (I removed the email:api_token base64 encoded string from this example)

curl -D- -X GET -H "Authorization: Basic <base64 encoded email:token>" -H "Content-Type: application/json" https://threadsculture.atlassian.net/rest/api/2/issue/createmeta

Here's the response:

HTTP/2 401 
server: AtlassianProxy/1.15.8.1
content-type: text/plain
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Wed, 13 May 2020 18:57:55 GMT
atl-traceid: 38b42bf62a17ae10
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
expect-ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400

Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html

Is there something I am missing from the request?

 

 

1 answer

1 accepted

2 votes
Answer accepted
Sam Cogheil
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 30, 2020

I battled with this error for some time today trying every example / format under the Sun (and cursing Atlassian), until I eventually determined that I missed a character off the original token - when I copied it from a saved location, to convert it to base64 -- effectively resulting in an invalid token.

And, unfortunately - if the Token (raw or base64 encoded) is wrong - you get the "401 - Basic authentication with passwords is deprecated" error - which can be misleading.

So... I would suggest that you double-check the token and try the request without base64. i.e.

curl -D- -X GET -u joe@bloggs.dom:xxxtokenxxx -H "Content-Type: application/json" https://threadsculture.atlassian.net/rest/api/2/issue/createmeta

Then once it is working - go back to base64 (if required / with the correct/corrected string):

curl -D- -X GET -H "Authorization: Basic xxxxxxbase64encodedxxxxxx" -H "Content-Type: application/json" https://threadsculture.atlassian.net/rest/api/2/issue/createmeta

 Also note: api/3 is now in Beta.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events