Error: Unauthorized 401

Hi,

I have a little problem with my script.

I’m using the documentation of Jira, I want returns the details for an issue thanks to the method ‘get issue’. I’m using NodeJS.

I have this error : ( Response 401)

This script worked very well. I just wanted to create another issue (SCII-5) and now this error is displayed…

Thank you in advance for your help.

var request = require('request');

var options = {
   method: 'GET',
   url: 'https://actility.atlassian.net/rest/api/2/issue/SCII-5',
   headers: {
      'Accept': 'application/json',
      'Authorization': 'Basic <base64 encode username:password>'
   }
};
request(options, function (error, response,issue) {
   if (error) throw new Error(error);
   console.log(
      'Response: ' + response.statusCode + ' ' + response.statusMessage
      );
      
   });
   
   

@anon22528121 Basic authentication has been deprecated and can no longer be used to authenticate against the Jira Cloud REST API.

Yes, you are right.
But it’s only for test and it worked correctly before that I changed the issue.

Hello @anon22528121,

Since usage of passwords in basic auth is being deprecated (see ACJIRA-1465), have you tried using Basic email:apiToken for authentication?

Cheers,
Ian

3 Likes