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.

18 lines
513 B

const fastify = require("fastify");
const fp = require("fastify-plugin");
const boom = require("boom");
async function decodeToken(request) {
let token = request.headers.authorization;
request.headers.authorization = token;
console.log("------------------");
// data = await request.jwtVerify()
await request.jwtVerify(token, (err, decoded) => {
if (err) fastify.log.error(err);
console.log("username : " + decoded.username);
});
}
module.exports = fp(decodeToken, { fastify: ">=1.0.0" });