ACE asUserByAccountId is null and more

Hi, I am trying to act on behalf of the user using ACE (Atlassian Connect Express) but things are not working. Unfortunately, I have not worked with Express.js before so some questions might be very basic.

  1. How do I make a request to the host from my app? The documentation specifies how to protect a call back to the host, but not how to actually make it. For now, I am testing with a link i.e. <a href="/protected-resource?jwt=myToken">See more</a> but doing this with AP.request(/protected-resource?jwt=myToken) does not work

  2. when I follow the endpoint configuration and get the token using the token content variable just like in the docs I get an Authentication verification error (401): JWT claim did not contain the query string hash (qsh) claim error. I tried googling that but I am not getting any smarter… Help!

  3. I removed addon.authenticate for now just to get a proof of concept working but that left me totally confused. again, following the docs closely, I have my endpoint configured as such

app.get('/test', addon.authenticate(), (req, _res) => {
  var httpClient = addon.httpClient(req);
  httpClient.asUserByAccountId('myAccountId').get('/rest/api/latest/myself', 
  function(err, res, body) {
    console.log(err,res,body)
  })})

but this is throwing TypeError: Cannot read properties of null (reading 'asUserByAccountId') and I am left completely puzzled. What am I doing wrong???

Figured it out. the href link seemed not to include the request context required for the asUserByAccountId command. Now I am using axios.get(’/myEndpoint’) and I changed addon.authenticate to addon.checkValidToken so this works now.