jwt.verify into promise mongoose with typescript

The solution for “jwt.verify into promise mongoose with typescript” can be found here. The following code will assist you in solving the problem.

const verifyToken = (token: string, secret: Secret): Promise => {
return new Promise((resolve, reject) => {
jwt.verify(token, secret, (err, decode) => {
if (!err) {
resolve(decode as T);
} else {
reject(err);
}
});
});
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in