js jwt decode
const jwt = require('jsonwebtoken');
const token = 'your_jwt_token_here';
const secretKey = 'your_secret_key_here';
const decodedToken = jwt.verify(token, secretKey);
console.log(decodedToken);
- Import the
jsonwebtoken
library. - Set the JWT token and secret key.
- Use
jwt.verify()
to decode and verify the JWT token with the provided secret key. - The decoded token is stored in the variable
decodedToken
. - Print the decoded token to the console.