Node.js Token Generator Code
Example Node.js code to generate an API Token
var crypto = require('crypto');
var secret = 'testsecret';
var timestamp = new Date().getTime();
var ip = '192.168.1.1';
var tokenString = secret + ':' + ip + ':' + timestamp;
var hmac = crypto.createHmac('md5', secret);
hmac.setEncoding('hex');
hmac.end(tokenString, function () {
var token = hmac.read();
console.log(token);
});Example
Last updated
Was this helpful?