I just wanted to implement a feature that has something to do with checking permissions. For this, the JWT context is usually very handy as it contains things like the content ID, the space key and the space ID. Since it is signed, I also know that I don’t have to perform an extra roundtrip to check whether the user actually has permission to access the page or space in question.
Now, when working on my feature I realized that the JWT context (as well as
AP.context.getContext) seems to be empty within custom Macro Editor iframes. The only way I found right now to even get the space key via JS in a custom Macro Editor was
AP.navigator.getLocation. So, I can at least put it inside my request manually. But this means I have to perform an extra roundtrip from my backend to check whether the user actually has the right permissions.
Is there any reason for the JWT context missing in custom Macro Editors, or am I just doing something wrong?
P.S.: Maybe I should mention that for the feature in question I cannot use URL parameters defined in the descriptor.