You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import expressJwt from 'express-jwt';
import User from "../models/user";
function jwt(){
const secret = process.env.JWT_SECRET;
return expressJwt({secret, algorithms: ['HS256'], isRevoked}).unless({
path : [
{ url: '/', methods: ['GET'] },
]
})
async function isRevoked(req, payload, done){
const user = await User.findById(payload.sub);
if (!user) {
return done(null, true);
}
done();
}
export default jwt;
The code run without any error in version 6.1 of express-jwt, but failed with error after upgrade to 8.4.1
error message as below:
/Users/zhihong/workspace/iot-portal/iot-journey-api/dist/config/jwt.js:14
return (0, _expressJwt.default)({
^
TypeError: (0 , _expressJwt.default) is not a function
at jwt (/Users/zhihong/workspace/iot-portal/iot-journey-api/dist/config/jwt.js:14:34)
at Server.create (/Users/zhihong/workspace/iot-portal/iot-journey-api/dist/Server.js:62:30)
at Object.<anonymous> (/Users/zhihong/workspace/iot-portal/iot-journey-api/dist/index.js:33:29)
at Module._compile (node:internal/modules/cjs/loader:1255:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
at Module.load (node:internal/modules/cjs/loader:1113:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
How can I fix this issue?
Thanks a lot,
James
The text was updated successfully, but these errors were encountered:
Hello,
Here is my code:
The code run without any error in version 6.1 of express-jwt, but failed with error after upgrade to 8.4.1
error message as below:
How can I fix this issue?
Thanks a lot,
James
The text was updated successfully, but these errors were encountered: