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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to create Basic authentication for JIRA REST API in node JS

help me in creating authentication for JIRA REST API in node js with just username and password of jira atlassian account .

1 answer

0 votes
Dario B Atlassian Team Jul 01, 2021

Hello @Natnael Tamrat ,

Welcome to the Atlassian Community!

Please notice that basic authentication with username and password has been deprecated long time ago in Cloud and that you now have to use Atlassian account email address and API token instead:

 

For the rest, all you have to do is to add an authorization header to your call built by following the instructions you can find in the "Supply basic auth headers" section of the Basic Auth for REST API documentation page for Jira Cloud:

Supply basic auth headers

You can construct and send basic auth headers. To do this you perform the following steps:

  1. Generate an API token for Jira using your Atlassian Account.
  2. Build a string of the form useremail:api_token.
  3. BASE64 encode the string.
    • Linux/Unix/MacOS:
      echo -n user@example.com:api_token_string | base64
    • Windows 7 and later:
      $Text = ‘user@example.com:api_token_string’
      $Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
      $EncodedText = [Convert]::ToBase64String($Bytes)
      $EncodedText
  4. Supply an Authorization header with content Basic followed by the encoded string. For example, the string fred:fred encodes to ZnJlZDpmcmVk in base64, so you would make the request as follows:
    curl -D- \
       -X GET \
       -H "Authorization: Basic ZnJlZDpmcmVk" \
       -H "Content-Type: application/json" \
       "https://your-domain.atlassian.net/rest/api/2/issue/QA-31"

 

 

Finally, for the future, please notice that this is not the best place to get help on development  related questions. The right resources are listed in https://developer.atlassian.com/resources. 

Specifically:

 

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you