Skip to content

Instantly share code, notes, and snippets.

@ShivamRawat0l
Created December 22, 2021 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShivamRawat0l/6e30d7de7f4aa31c378201600f0321cc to your computer and use it in GitHub Desktop.
Save ShivamRawat0l/6e30d7de7f4aa31c378201600f0321cc to your computer and use it in GitHub Desktop.
Kustomer Sdk v2 jwt token creator
const express = require("express");
var jwt = require("jsonwebtoken");
// An `iat` is not required because `jsonwebtoken` auto-generates one
const app = express();
const header = {
"Content-Type": "application/json",
Authorization: "Bearer API_KEY",
};
app.get("/", (req, res) => {
var token = jwt.sign(
{
email: "CUSTOMER_EMAIL",
iat: "CURRENT_TIME_UTC",
},
"SECRET_KEY",
{
header: {
alg: "HS256",
typ: "JWT",
},
}
);
res.json({
a: 10,
});
});
app.listen(8000, () => console.log("Hello")); //8000,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment