Closed kadosh1000 closed 6 years ago
Hello, try like this
app.use((req, res, next) => {
passport.authenticate('jwt', {session: false}, (err, user, info) => {
if (!user) {`
console.log('no user found in JWT', info)
}
next()
})(req, res, next) // You must put this;
})
@EddyTheDove Thanks I have used it that way pretty much after posting this issue and forgot to comment and close it.
Thanks anyway!
Hi, I am trying to wrap the authenticate method so I can always check for user. I have tried the following
But it never gets to the console.log and instead directly responses with 401. Is there a way to prevent it and simply return the callback so I can define the desired action?