AP.context.getToken() works fine in the web-panel or web-page context so that you don’t have to worry about expired JWT token which can be easily refreshed on the client-side.
However it doesn’t work for cloud gadgets - jiraDashboardItems modules.
If you run the below code from the documentation
AP.context.getToken(function(token){
console.log("JWT token string", token);
});
You will get the below error for the second and all subsequent calls:
POST https://dev.atlassian.net/plugins/servlet/ac/net.brokenbuild.gadget/velocity-gadget 404
ACJS: content resolver failed to get context jwt token
This token refresh feature is super useful and it would be great if it works properly for gadgets too.
Here is the open issue about this reported by another vendor - [ACJIRA-1968] - Ecosystem Jira
Thanks,
Vasiliy