Forums

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

passport-atlassian-oauth2

alamrezoanul August 22, 2019

Hi Folks,

I've created a project using node module "passport-atlassian-oauth2" and i get the accessToken successfully. But when I do a request to create an issue I get the error "

Client must be authenticated to access this resource.

". Below is my code for create issue jira api:

var bodyData = { "fields": { "project": { "key": "FLUX" }, "summary": "REST ye merry gentlemen.", "description": "Creating of an issue using project keys and issue type names using the REST API", "issuetype": { "name": "Bug" } } };

var baseUrl = 'https://alamrezoanul.atlassian.net';

var options = { method: 'POST', url: `${baseUrl}/rest/api/3/issue`, data: JSON.stringify(bodyData), headers: { 'Authorization': 'Bearer ' + jiraTokens.accessToken, 'Content-Type': 'application/json' }, json: true };
axios(options) .then((response2) => { console.log("response2.data: ", response2.data); }) .catch((error) => { console.log("error: ", error); })

 

Could you help please?

2 answers

1 accepted

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 28, 2019

Thanks for sharing @alamrezoanul !

As already mentioned, for the future please remember to ask this kind of questions in the Developers Community instead :) 

Cheers,
Dario

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2019

Hi @alamrezoanul ,

 

I may not be the best person to answer this question, however, before going any further, can you kindly let us know what you are trying to achieve?

I am asking this because, as written in the OAuth 2.0 (3LO) for apps documentation page, different authorization methods should be used in different scenarios and you might need to use a different one: 

Which authentication method should I use?

 

Also, as mentioned on the top of the passport-atlassian-oauth2 documentation page:

Before using passport-atlassian-oauth2 you must register an application within App Management.

Have you actually done this?

 

Finally, kindly notice that this is not the best place to get help on development related issues. For the future, please refer to the resources listed in: https://developer.atlassian.com/cloud/jira/platform/get-help/

Specifically:

 

Cheers,
Dario

alamrezoanul August 27, 2019

Hi Dario, Thanks for your answer. It is solved by asking a question in stackoverflow. Thanks anyway.

Like Dario B likes this
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2019

Hi @alamrezoanul ,

Can you kindly either paste the solution or the link to the thread in stackoverflow so that, in case, it can be useful to other users as well?

 

Cheers,
Dario

Like Andres LeonRangel likes this

Suggest an answer

Log in or Sign up to answer