Why I am getting refuse to connect message

When I am using this code

const response = await api
    .asUser()
    .requestJira(route`/rest/api/2/project/${projectId}/role`, {
      headers: {
        Accept: "application/json",
      },
    });
  console.log("Response",response);
  const data = await response.json();
  console.log("Data from api : " + data);

I am getting error like this
Refused to connect to

 '[https://jira/rest/api/2/project/10000/role'](https://jira/rest/api/2/project/10000/role%27) because it violates the following Content Security Policy directive: "connect-src 'self' [https://api.atlassian.com/metal/ingest".]

Hey @JainDivyanshu,

Judging by the Content Security Policy message I assume you are trying to call Jira APIs from a frontend module. The @forge/bridge package should be used in this case: https://developer.atlassian.com/platform/forge/apis-reference/ui-api-bridge/requestJira/

Let me know if this isn’t the case and we can dig a little deeper.

1 Like

Thanks SamSmyth
@forge/bridge is working fine