Open flahol opened 2 years ago
Can you provide a stack trace for that error? It will help diagnose where the actual issue is.
I don't know how I can get the stack trace I have no error on the console
If you set the NODE_ENV
environment variable todevelopment
(NODE_ENV=development
), that should print out the stack trace.
I set NODE_ENV=development but it does not return anything in the console:
> obizoo-back@1.0.0 dev /home/patrice/Websites/obizoo/obizoo-back
> export NODE_ENV=development && nodemon --trace-deprecation --experimental-specifier-resolution=node server.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --trace-deprecation --experimental-specifier-resolution=node server.js`
development
Server obizoo api is running on port 8080.
Unfortunately, without a stack trace its going to be hard to reproduce this issue or pinpoint it to a bug in Passport. Please update this issue with that information once you have it. Thanks.
Using passport-http-bearer, the done function with false as a user throws an error.
Same error if using passport-jwt
Expected behavior
From passport documentation :
By default, if authentication fails, Passport will respond with a 401 Unauthorized status, and any additional route handlers will not be invoked. If authentication succeeds, the next handler will be invoked and the req.user property will be set to the authenticated user.
Actual behavior
Environment