As we are building a new Oauth 2 3LO based app, we are following the excellent docs.
It suggests that with the resulting access token, we should make requests to api.atlassian.com using this base URL:
The Jira REST API supports being called by both OAuth 2.0 (3LO) apps and Connect apps. OAuth 2.0 (3LO) apps must use api.atlassian.com whilst Connect apps must use your-domain.atlassian.net. The different base URLs are based on differences in the way we authenticate and authorize requests.
a 401 “client must be authenticated to access this resource” when using <my-project>.atlassian.net/rest/api/2/webhook
What would be the correct way to authenticate a call to JIRA REST API from within a Connect App?
If JWT is intended to be used in this case, can you give me an example on how to generate the JWT token for the REST API call, using the atlassian-connect-express?
Answering myself: Atlassian-Connect-Express comes with a utility httpClient based on Request, which automatically handle the JWT token for REST API requests: Bitbucket see section " How to send a signed outbound HTTP request back to the host" in README.md.
Specifically, the part of the ACE library handling the JWT is here, I paste as a note for future me or whoever might be interesting in knowing how this works, since Request library has been deprecated in Feb 2020, might get handy to see how to replicate this utility using other libraries for REST API request.
OAuth does not seems related here, I mixed different types of Atlassian Apps I guess