Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

forge/api requestJira trying to reach https://jira/rest/api instead of my own domain

Illés Ákos
Contributor
January 27, 2025

I'm developing a Forge app that is listing out all the remote links associated with a customer request in Jira Service Management for all of the customers to see. My problem is that the api.asApp().requestJira(route`/rest/api/3/issue/${issueKey}/remotelink`); method is evaluated to: https://jira/rest/api/3/issue/MYISSUEKEY/remotelink instead of https://MYCOMPANY/rest/api/3/issue/MYISSUEKEY/remotelink. Thus violating the document's Content Security Policy, more specifically this directive: "connect-src 'self' https://api.atlassian.com/metal/ingest". I tried to use forge/bridge requestJira before, but as of my knowledge it only uses the user as the caller, so it doesn't meet my use-case, that customers should also be able to see the results. And also this is why I intend on using the app as a caller for the endpoint. 

Here are the permissions I gave to the app: 

 

permissions:
  scopes:
    - read:jira-work
    - read:issue.remote-link:jira
    - read:issue:jira
    - read:servicedesk-request
    - read:status:jira
And here are the unlicensed access:

 

      unlicensedAccess:
        - customer
        - unlicensed
Please someone help me understand why does requestJira trying to call https://jira instead of my own site, and also I would very much appreciate suggestions on how to resolve this issue.

1 answer

1 accepted

2 votes
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2025

Hi @Illés Ákos 

 

You have to import route and use it to build your endpoint.

import api, { route } from '@forge/api';

api.asApp().requestJira(route`/rest/api/3/myself`);

 

Regards

 

Illés Ákos
Contributor
January 28, 2025

Hi, thank you for your answer!
I indeed had some imports missing, but a bigger problem was that I could not invoke the REST API from the frontend for some reason and the reason for the error I believe was invoking from the frontend. I rewrote my code in the resolvers/index.js file and now it works fine. Also a good tip for anyone starting out and reads this, is that just because the forge cli tells you your latest version is installed it is not always the truth...

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2025

Ya not easy to start. This video helped me a lot when I started with Forge and development using node and TS.

https://www.youtube.com/watch?v=dpxbgTRKEGo

Like Illés Ákos likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events