Skip to main content
#P1224

Node.js (با استفاده از کتابخانه jsonwebtoken)

const jwt = require('jsonwebtoken');

const key = "your_secret_key";
const header = {
    "alg": "HS256",
    "typ": "JWT"
};
const payload = {
    "iss": "Your domain",
    "aud": "Your level",
    "iat": Math.floor(Date.now() / 1000),
    "uuid": "Your ID",
    "uip": "Your IP"
};

const token = jwt.sign(payload, key, { algorithm: 'HS256', header: header });
console.log(token);