Mockoon templating system includes various helpers to help you create dynamic responses. This page lists the helpers related to JWT tokens.
Extract a property from a JWT token's payload. The full token must be passed as the first argument. It will automatically ignore the Bearer
prefix if present, to make it easier to use it with the Authorization
header.
If no property is passed, the full payload object will be returned to be used with other helpers like lookup
.
Arguments (ordered) | Type | Description |
---|---|---|
0 | string | JWT token |
1 | string | Property |
Examples
Copy<!-- Returns the full payload object --> <!-- Returns the 'sub' property using lookup --> <!-- Returns the 'sub' property --> <!-- Use with header helper (no need to remove 'Bearer ' from the header content) -->
Extract a property from a JWT token's header. The full token must be passed as the first argument. It will automatically ignore the Bearer
prefix if present, to make it easier to use it with the Authorization
header.
If no property is passed, the full header object will be returned to be used with other helpers like lookup
.
Arguments (ordered) | Type | Description |
---|---|---|
0 | string | JWT token |
1 | string | Property |
Examples
Copy<!-- Returns the full payload object --> <!-- Returns the 'alg' property using lookup --> <!-- Returns the 'alg' property --> <!-- Use with header helper (no need to remove 'Bearer ' from the header content) -->