How to sign JWT on other RESTAPI service?

We have developed a atlassian spring boot app to deploy as a gadgets in jira dashboard.

We are able to sign JWT for the jira cloud apis,

But when we try to execute code the below,

private AtlassianHostRestClients restClients;

String str = “”;

String result = restClients.authenticatedAsHostActor().getForObject(str, String.class);

I get the error on the jira dashboard as "{“status”:500,“error”:“Internal Server Error”,“message”:“Aborting the request to (please find the this link above, created for this post)jirareports/jr/aio/rest/report/export?token=YzNmMTBmNzQtODkzNi00M2QxLWIyMjQtNTlmMjMxMTQzNGFh&ID=32375&format=json /jr/aio/rest/report/export because the user you’re trying to make a request as does not reside on this host. The base url of the user’s instance is”,“timeStamp”:“Wed Feb 07 17:34:41 IST 2018”,“trace”:null} "

So for all the same hosts, JWT is working but not for others web services(When disabling the JWT for that particular method, it working!!!).

How can I sign the other web services or we can just ignore the JWT because in there is already token passed in the other API service?

This looks like it is a request to a service that is not an Atlassian Cloud instance. Can I ask what problem you are trying to solve by using JWT in this instance?

Is it necessary to sign the JWT for other REST API calls( which includes their own token to authenticate)?

Basically we are authenticating the incoming and outgoing requests using JWT( it works for jira cloud apis ).

If the HTTP Request is going to an Atlassian Cloud Product (like Jira or Confluence) then you need to sign the request. If your HTTP request is going to another service, then you need to do whatever that other service requires.