I got an authentication message when trying to get the sprints in Forge app using jira:workflowPostFunction module.
message: ‘Authentication required’,
name: ‘NEEDS_AUTHENTICATION_ERR’,
stack: ‘’
The RESTApi to read the sprint is:
/rest/agile/1.0/board/{boardId}/sprint.
In the forge app, the function to call the restapi is:
api.asUser().requestJira(…);
In manifest file, permissions used are:
- manage:jira-configuration
- read:jira-work
- read:jira-user
- read:sprint:jira-software
The Forge app is executed when running the issue’s transition, and then got the message mentioned above in the forge logs.
I have the same Forge app but using jira:customField module. All are the same as above, but I did not got the authentication message, the customField is able to get all sprints.
I am always using administrator level account for my development.
I understand that the restapi is required OAuth2.0.
But why jira:customField module did not got any error but the jira:workflowPostFunction?
This is the line to call the restapi I used for both apps:
const response = await api.asUser().requestJira(
route`/rest/agile/1.0/board/${rdBoard.Id}/sprint`,
{method: 'GET', headers: {'Accept': 'application/json'}}
);
If I have to use 'Authorization': 'Bearer <access_token>'
in the header, whose token should I use? my administration token? or atlassian-addons-project-access?
Thanks.