Facebook-passport with JWT

The best solution I found for that problem would be to redirect to the expected page with a cookie which holds the JWT. Using res.json would only send a json response and would not redirect. That’s why the other suggested answer here would not solve the problem I encountered. So my solution would be: app.get(‘/auth/facebook/callback’, … Read more

ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client

That particular error occurs whenever you try to send more than one response to the same request and is usually caused by improper asynchronous code. The code you show in your question does not appear like it would cause that error, but I do see code in a different route here that would cause that … Read more