Create a JWT token using your private key

import jsonwebtoken from "jsonwebtoken";
import fs from "node:fs";

const privateKey = fs.readFileSync("private.pem").toString();

const jwt = jsonwebtoken.sign({}, privateKey, {
    issuer: this.url,
    subject: this.company_id,
    audience: 'brouwervos.nl',
    algorithm: 'RS256',
});

console.log(jwt);

Last updated