-
-
Save ShivamRawat0l/6e30d7de7f4aa31c378201600f0321cc to your computer and use it in GitHub Desktop.
Kustomer Sdk v2 jwt token creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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