Marcel Scheck
10/08/2025, 6:54 AMcode. I use serveEventListeners to trigger a call. This call needs to extract the sub claim from the JWT and include it as user_id to body. I tried it with the jwt plugin like this {{jwt path='sub' token=originalRequest.query.code}} but it generated a new jwt, what is not really what I need. Is there any way to only extract that claim from the token?Marcel Scheck
10/08/2025, 6:56 AMserveEventListeners part of my mapping:
"serveEventListeners": [
{
"name": "webhook",
"parameters": {
"method": "POST",
"url": "<https://example.org/event-listener>",
"body": "{\"id\": \"{{randomValue type='UUID'}}\", \"user_id\": \"{{jwt path='sub' token=originalRequest.query.code}}\""
}
}
]Tom
10/08/2025, 8:41 AM{{#formatJson}}
{{regexExtract request.query.code '(.*?)\.(.*?)\.(.*?)' 'parts'}}
{{val (base64 parts.1 decode=true) assign='jwtBody'}}
{{val (jsonPath jwtBody '$.sub') assign='sub'}}
{
"user_id": "{{sub}}"
}
{{/formatJson}}Marcel Scheck
10/08/2025, 12:12 PM