diff --git a/src/core/operations/JWTSign.mjs b/src/core/operations/JWTSign.mjs index af46908e6..73490cf5a 100644 --- a/src/core/operations/JWTSign.mjs +++ b/src/core/operations/JWTSign.mjs @@ -36,6 +36,11 @@ class JWTSign extends Operation { name: "Signing algorithm", type: "option", value: JWT_ALGORITHMS + }, + { + name: "Header", + type: "text", + value: "{}" } ]; } @@ -46,11 +51,12 @@ class JWTSign extends Operation { * @returns {string} */ run(input, args) { - const [key, algorithm] = args; + const [key, algorithm, header] = args; try { return jwt.sign(input, key, { - algorithm: algorithm === "None" ? "none" : algorithm + algorithm: algorithm === "None" ? "none" : algorithm, + header: JSON.parse(header), }); } catch (err) { throw new OperationError(`Error: Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA.