createToken.js 389 B

1234567891011121314151617
  1. const jwt = require('jsonwebtoken');
  2. const config = require("../configs/config.json");
  3. exports.createToken = function (login_id) {
  4. return new Promise((result, reject) => {
  5. const token = jwt.sign(
  6. { login_id: login_id },
  7. config.token_header_key,
  8. {
  9. expiresIn: "2h",
  10. }
  11. );
  12. result(token);
  13. });
  14. }