Access problem for the study of an issue (Error 403)

rest-api

#1

Hello,

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. (https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest&utm_medium=302#api-api-3-issue-issueIdOrKey-get)

But I have this error : ( Response 403) “Failed to parse Connect Session Auth Token”, normally I have the permission for access but have always same error

I’m using my API token from https://id.atlassian.com/manage/api-tokens but the same error persists…
When I put my url into the browser, I have many values ​​that are displayed but programmaticaly side, the same error is display …

// This code sample uses the 'request' library:
// https://www.npmjs.com/package/request
var request = require('request');

var options = {
   method: 'GET',
   url: 'https://actility.atlassian.net/rest/api/3/issue/SCII-1',
   auth: { bearer: '<***>' },
   headers: {
      'Accept': 'application/json'
   }
};

request(options, function (error, response, body) {
   if (error) throw new Error(error);
   console.log(
      'Response: ' + response.statusCode + ' ' + response.statusMessage
   );
   console.log(body);
});


   

Thank you in advance for your help.


#2

Hello @noreez.ulhassanshah,

It seems you’re using basic auth, one way you can do is:

  1. Remove this part auth: { bearer: '&lt;***&gt;' },
  2. In your headers add 'Authorization': 'Basic <Base64 encoded email:apiToken pair>

I did a quick spike and this approach worked for me.

Cheers,
Ian


#3

Hi

Thank you for your help

Best regards,
Noreez