Hi All,
I am trying to add attachment as mention in the guide in nodeJs https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-group-issue-attachments
But I am getting OAuth 2.0 is not enabled.
Here is my code:
const rootPath = path.join(__dirname, 'attachmentsToAdd.txt');
const form = new FormData();
const stats = fs.statSync(rootPath);
const fileSizeInBytes = stats.size;
const fileStream = fs.createReadStream(rootPath, 'utf8');
form.append('file', fileStream, { knownLength: fileSizeInBytes });
const response = await axios.post(
`https://api.atlassian.com/ex/jira/${resourceId}/rest/api/3/10057/attachments`,
form,
{
headers: {
Accept: 'application/json',
'X-Atlassian-Token': 'no-check',
Authorization: `Bearer ${accessToken}`,
},
},
);
As mention in the guide this should work with oauth2 and I have the relevant scope.
What could be the issue here?
Thanks!
@Gilgamesh Sumsum Most likely you are not using the right access-token properly in your code, see how to generate API token https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
Try and let me know
Kind regards,
Moses
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.