The expiration time in jwt keeps the program from reporting errors.

I used until"s promisify to change the verify in jwt into Synchronize"s. When I called this function and passed in an expired token, he reported an error and the program stopped going!

const util = require("util");
const verify = util.promisify(jwt.verify)
async getToken (cookieStr){
    return  verify(cookieStr.replace(/(^\s*)|(\s*$)/g, ""), "screct").then(function(res){
        return res
    }).catch(function(err){
        return false
    })
}
let PAYLOAD= await getToken(ctx.header.authorization)
erver error { TokenExpiredError: jwt expired
    at E:\demo\node_modules\_jsonwebtoken@8.3.0@jsonwebtoken\verify.js:141:21
    at getSecret (E:\demo\node_modules\_jsonwebtoken@8.3.0@jsonwebtoken\verify.js:76:14) }

jwt.verify(cookieStr, this.sign, function (err, decode) {
    if (err) {  //  / token          
       rs.json({err:err})
    } else {
        rq.decode = decode; 
        console.log(decode.msg);   // today  is  a  good  day
        next();
    }
})
Jul.07,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3f967-44846.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3f967-44846.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?