Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Rest API Authentication using bearer auth returning status 403

donahcandia
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!
December 27, 2018

Hi,

I am currently doing a code in nodes that would search for a specific issues with a certain status assigned to a certain user. I am following the code that is found on this link: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-api-3-search-get

What is not clear is the bearer part, I'm not sure where I can get the access_token. I've created a API-token already still it gives me a 403 status.

Below is the code I am using:

var options = {
method: 'GET',
url: 'https://wordbean.atlassian.net/rest/search?jql=assignee in ("username") and status in (Handover, "In Review") and type not in ("Epic", "Story", "Client Project", "Daily Task")'',
auth: { bearer: ('donahcandia@gmail.com:mj0G54PBrKrDKdbNRWnSB44A').toString('base64') },
headers: {

'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
};

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

 

How do I get and identify the access_token? and can anyone show on how to fix the bearer auth issue.

 

Thank you.

1 answer

0 votes
davy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 31, 2018

Hi Donah,

To generate an access token on Atlassian Cloud please have a look at the documentation - API tokens

In the documentation you will also find an example how to use the token in your query

below I have added a curl example

curl -s -X GET -H "Content-Type: application/json" "https://wordbean.atlassian.net/rest/api/3/search?jql=assignee%20in%20('donahcandia@gmail.com')" --user donahcandia@gmail.com:mj0G54PBrKrDKdbNRWnSB44A

(assuming mj0G54PBrKrDKdbNRWnSB44A is your token)

Best Regards,

Ryans

Suggest an answer

Log in or Sign up to answer