javascriptnode.jsjwtexpress-jwtnode-promisify

Why don't my promisify and jwt return values or errors?


if(req.cookies.token_name) {
    try {
        const decoded = await promisify(jwt.verifiy)(req.cookies.token_name, 
        process.env.jwtsecret);
        console.log(decoded);
    } 
    
    catch (error) {
        console.log(error);
    }
}

This is the bit I'm having problems with. It doesn't log the decoded variable but it also doesn't give any errors. Can anyone help me with this?


Solution

  • I think you have a typo in your function name, although it's hard to tell without seeing your import/require statements. verifiy should be verify.

    const decoded = await promisify(jwt.verify)(req.cookies.token_name, ...);