I am creating a Forge application in which I have added the read:jira-work
and write:jira-work
scopes in the manifest.yml
file. Also, while installing the application, it shows that my application has these scopes. However, when making API calls to create an issue in the application, I am receiving a permission error that says, ‘You do not have permission to create issues in this project.’
In my application, I have only one page that fetches issue details, and when submitting, I invoke my backend function, which calls a POST API to create the issue.
Also, i have admin access to my jira instance.
code snippet:
const requestUrl = route`/rest/api/3/issue`;
const response = await requestJira(requestUrl, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
Hi @ParthpuriGoswami1,
It sounds like you’re making this call from the backend of your app (eg from src/resolvers/index.js
) , which means you’re using the forge API - in that case, you need to Authenticate your call using either forges built in Authentication or via the API call itself (when you use the forge bridge from the front end it works a little differently(.
You can read more in the requestJira docs.
Here’s an example of how you can fix it using your code:
// make sure you're using the correct api import for the backend
// you might need to run `npm install @forge/api` from your app top directory to install this package
import api, { route } from '@forge/api';
// ... the rest of your app ...
const requestUrl = route`/rest/api/3/issue`;
const response = await api.asUser().requestJira(requestUrl, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
I hope this helps. If this has resolved the issue for you please mark it as the solution. If you’re still stuck please let me know more about your app (eg are you building in customUI or UI Kit, what is the file you’re making this call from etc)
Cheers!
Mel
1 Like
Thanks, it’s working!
Since I am new here, I want to understand how Forge Tunnel works or how i setup my development environment. I am building an application with a custom UI that also makes Jira API calls. During development, I don’t want to deploy every time to my Jira Cloud instance. I see Forge Tunnel, but since it runs locally, I want to know how I can ensure that my Jira API calls, such as creating issues or getting projects, are working correctly. Because while using tunnel i am getting “Failed to establish ready state with product”.
Hey @ParthpuriGoswami1,
If you haven’t already, I’d make sure you’ve run through the 'Build a custom UI app’ tutorial - which will guide you through creating an app and includes instructions for tunneling, deploying and setting up your environment.
If you’re still experiencing issues with your tunnel, please create a new post about that as a separate thread (or you could try searching for the error you’re seeing) so that someone can see you still need help.
Cheers!
Mel