Using JWT token and the REST-ful table


we are using the REST-ful table in an atlassian-connect-express application. Our endpoints are using addon.checkValidToken() to secure the calls.

As described in the documentation of the ACE toolkit, we are using a meta tag to store the given JWT token:

<meta name="token" content="{{token}}">

We read the token in our javascript files to use it for API calls. This works fine for other components, but we are not sure how to provide the JWT token when using the REST-ful table. Our current approach was to add the token directly to the URL as parameter:

resources: {
    all: `api/project/${projectKey}/glossary_entries?jwt=${jwt_token}`,
    self: `api/project/${projectKey}/glossary_entry?jwt=${jwt_token}`

This works fine for GET requests but does not work for specific GET, DELETE or PUT requests as the table adds the ids of the selected elements to the URLs.

Therefore the URLs look like this:
/api/project/<project key/glossary_entry?jwt=/

This leads to an invalid JWT token which can’t be decoded. Is there another way to use JWT token with the REST-ful table?

All the best

Hi @AndreasB I am also starting to integrate restful table and faced your issues also many times. JavaScript API offers the getToken method:

Have you tried to wrap your Js functions with it?! This works pretty fine:

  console.log("JWT token string", token);

Best Valentin