Creating id_token with Javascript
Sample Code to generate a id_token using Javascript
var jwt = require('jsonwebtoken');
var fs = require("fs");
// sign with RSA SHA256
var privateKey = fs.readFileSync('<env><partner_name>privatekey.pem');
const idToken = jwt.sign(
{ stockal_username: '<stockal-customer-id>' },
privateKey,
{
algorithm: 'RS512',
expiresIn: "60",
audience : 'stockal.com',
issuer : '<YOUR_PARTNER_CODE>'
});
console.log(idToken);
Updated almost 3 years ago