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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
- Connect apps: Use JWT. You can also use OAuth 2.0 user impersonation.
- Other apps: Use OAuth 2.0 (3LO) for authentication and authorization.
- Not using an app: Use OAuth 1.0a.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dario, Thanks for your answer. It is solved by asking a question in stackoverflow. Thanks anyway.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.