custom reponse passport jwt
-
các pro cho e hỏi có cách nào custom reponse của passport jwt trong expressjs không ạ e dùng nó auto reponse Unauthorized
route của e
router.get('/api/users/get-list', passport.authenticate('jwt', { session: false }), UserController.list);
thank các
-
mình nghĩ bạn nên thêm một hàm if nếu có cái authenticalted thì load đến router đó
-
router.get('/api/users/get-list', (req, res, next) => { passport.authenticate('jwt', { session: false }, (err, user, info) => { // Handle here next() }) }, UserController.list)