Wednesday, 23 September 2020

Why is a public endpoint returning a 401 unauthorized?

Hello, everyone. I have a node app, that's using Express, that has a couple of endpoints. Some of them require authentication, others do not. For the authenticated ones we're using passport local strategy with express-jwt.I'm currently facing an issue on a production environment, where sometimes, very rarely, I'll get a 401 unauthorized on a public endpoint. The route definition uses no middleware, just straightforward express routing like this:const router = express.Router(); router.post('/endpoint', controller.endpointHandlerMethod); The method just makes some database calls and returns 200 if successful and 500 for any other error. Nowhere in that method is it throwing a 401 error so that makes it more difficult to understand. The app is running on Heroku.So, my question is - does anyone have any idea of what could be causing the 401 error?

Submitted September 23, 2020 at 07:00PM by DanteIsBack

No comments:

Post a Comment