You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rgvScleNestjs/test/testToken.js

14 lines
693 B

import jwt from 'jsonwebtoken'
// const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjVjMDdlNzRjLTFiYzctNDAzYy05NjUxLTI5YjgzZGM5ZGE4MSJ9.bC2MO_7dzBeuMH33z7l3Wlovl489aja1B1D3SB4ukJmGye_RDZCy5rmDw0tPGsNpbeYryxBG9OgWZSxEAKX5Kg'
//
const secretkey = 'abcdefghijklmnopqrstuvwxyz'
console.log(jwt);
const a = jwt.sign({ secretkey },secretkey, { expiresIn: '30m' })
// console.log(a);
const token = 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjVlOWQ1ZTMzLTI0MjEtNDJkYy1iZmU5LTI5Y2M1YjIxOWU4ZCJ9.VmZzLm2si5d51oe_ZPq9sB7ZF7GLuttjSjxQHdxQg49W4QU6PnLFzhAIeKYx0l4mfKj4uL4_IKyqPsm4t6znHg'
jwt.verify(token, secretkey, (error, data)=>{
console.log(error);
console.log(data);
})