Skip to content

Instantly share code, notes, and snippets.

@QuatoHub
Created November 23, 2021 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuatoHub/3647a06dc5de0307b987ebd3142ebab2 to your computer and use it in GitHub Desktop.
Save QuatoHub/3647a06dc5de0307b987ebd3142ebab2 to your computer and use it in GitHub Desktop.
const secretKey = ''; // 아까 token 만들때 썼던 secretkey
const router = (req, res) => {
const token = req.headers['x-access-token'] || req.query.token;
jwt.verify(token, secretKey,
function(err, decoded){
console.log(err) // 유효하지 않은 토큰
console.log(decoded) // 유효한 토큰, 유저 정보 Object 반환
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment