Basic Auth and JWT Basic Auth and JWT nginx nginx

Basic Auth and JWT


When I realised that the problem was the conflict between Basic Auth and JWT (as @Curious suggested in the commend), and that they are both using the Authorization header, the solution was quite easy.

I configure my front end application to send the JWToken via a custom header, **JWTAuthorization**, so when the request hits the server, it contains both headers Authorization & JWTAuthorization. Then it's pretty simple, after the basic auth is passed, I just replace the headers (here on the Node.js application, based on Koa):

app.use(function *(next) {  this.headers.authorization = this.headers.jwtauthorization;  yield next;});