Hi everyone
I’m facing an issue with nested macros in my app.
Specifically, the inner macro doesn’t have access to the userAccountId in its context, which is crucial for checking user permissions.
When I debug the requests that the inner macros send to our permissions endpoint, request.context.userAccountId is undefined.
Also, the jwt token, that the inner macro’s iFrame has, misses the sub property in the payload (which also is the userAccoundId).
However when I debug the function that renders the inner macro with express, all data is in this request.
After the render is done, I lose the trace because the renderer only creates HTML, but creating the iFrame around it isn’t in our hands.
The inner macro works fine when used outside of the other one and it gets rendered properly even inside of the other one.
Interestingly, I can access the current user in the frontend of the inner macro using AP.user.getCurrentUser.
But my only workaround was sending it as query parameter, which doesn’t feel like a very clean way of doing it, especially because the request should already contain the userAccountId in both the context as well as inside the JWT token’s payload.
Does anyone know how the context is created, or if there’s a way to pass it securely?
Or a reason why the iFrame of the inner macro doesn’t have user data when it’s nested?
Thanks in advance for any ideas.
Kind regards
Elias