All my paths are accepting JSON only. So it makes sense to use bodyParser.json() as middleware. The problem is that the authentication process is based on the raw payload. Authentication is done via a custom middleware. Is there any way to use bodyParser.json() and still being able to access the raw request payload?
I have found this solution
app.use(bodyParser.json({verify:function(req,res,buf){req.rawBody=buf}}))
here https://stackoverflow.com/a/30196898/3531412 but I think this is not the way verify is meant to be used.
Any suggestion here?