Created
November 23, 2021 14:24
-
-
Save QuatoHub/3647a06dc5de0307b987ebd3142ebab2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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