auth0 / express-jwt

connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: express_jwt__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function

inatu opened this issue · comments

The following code works fine for express-jwt@5.3.1, but got TypeError for express-jwt@7.7.0

import expressJwt from 'express-jwt'

const requireSignin = expressJwt({
secret: config.jwtSecret,
userProperty: 'auth',
algorithms: ["HS256"]
})

I am just start learning MERN, just don't know how to adapt this code to the latest express-jwt.

Sorry,
fixed with the documentation

hi . can u help me . I got the same issue

@vamsikrishna73 update the import to

import { expressjwt } from 'express-jwt'

Dont miss the the lowercase j in expressjwt. I did.

i am still getting the same issue even after doin j small
import {expressjwt} from 'express-jwt'; const requireSignin = expressjwt({ secret: config.jwtSecret, userProperty: 'auth' });
const requireSignin = (0,express_jwt__WEBPACK_IMPORTED_MODULE_2__.expressjwt)({
^

TypeError: (0 , express_jwt__WEBPACK_IMPORTED_MODULE_2__.expressjwt) is not a function
at eval (webpack://sample/./server/controllers/auth.controller.js?:69:78)
at ./server/controllers/auth.controller.js (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:30:1)
at webpack_require (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:240:41)
at eval (webpack://sample/./server/routes/user.routes.js?:8:86)
at ./server/routes/user.routes.js (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:84:1)
at webpack_require (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:240:41)
at eval (webpack://sample/./server/express.js?:18:77)
at ./server/express.js (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:52:1)
at webpack_require (C:\Users\visha\source\repos\vishalgusaiwal\Project_MERN\dist\server.generated.js:240:41)
at eval (webpack://sample/./server/server.js?:3:66)