Signs a payload object and produces a compact RFC 7519 JSON Web Token (JWT).
Key-value claims to bundle inside the JWT payload.
Shared HMAC symmetric secret key.
Signing options including algorithm, expiration, issuer, and audience.
A Promise resolving to the signed compact JWT string (header.payload.signature).
header.payload.signature
const token = await signJwt( { sub: "usr_100", role: "admin" }, "my-super-secret-key", { expiresIn: 3600, issuer: "auth.example.com" }); Copy
const token = await signJwt( { sub: "usr_100", role: "admin" }, "my-super-secret-key", { expiresIn: 3600, issuer: "auth.example.com" });
Signs a payload object and produces a compact RFC 7519 JSON Web Token (JWT).