Skip to content Skip to sidebar Skip to footer

Download File From Express Node.js With Jwt Authorization

I'm using the express-jwt module on my node.js server to authorize users access to different requests. One of the request will ultimately be a file download with express res.downlo

Solution 1:

A possible solution would be to modify your server side to expect something in the header like before, but in case of absence of this header to look into the parameters of the request to see if the value you are looking for is not there instead. It would not change your previous behavior for the other endpoints but it would allow you to download the file with a window.open and a parameter in the url. You can also limit this possibility to the endpoints giving access to files for more security.


Post a Comment for "Download File From Express Node.js With Jwt Authorization"