Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

API Token Basic Authentication

Andy Baird 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?

 

 

2 answers

1 accepted

2 votes
Answer accepted
Sam Cogheil 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.

0 votes
Shoaib Abbas September 18, 2023
  • Check the correctness of your API token, ensuring there are no typos.
  • Verify that your authentication header follows the correct format.
  • Ensure proper base64 encoding of your username and API token.
  • Confirm you're using the authentic username associated with your JIRA account.
  • Verify that your JIRA account has the necessary permissions for the API operations.
  • Make sure you're addressing the correct API endpoint with a properly formed URL.
  • Be aware of JIRA's rate limiting policies to avoid authentication issues.
  • Check for network-related problems that may affect your request response.
  • Review JIRA server configuration settings regarding API access and authentication.

Suggest an answer

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

Atlassian Community Events