I load the image in JS as follows:
var img = new Image();
img.onload = function () {
..
};
img.src = src;
This will work, but I realized that I had to protect my images on the server side with OAuth 2 (as with the rest of the application), and that could affect me just by getting 401 Unauthorized.
This is an angular application, and I have an interceptor that adds an authorization header, therefore, for all angular service requests to the server, but in this case, of course, the interceptor is not used because the call is not made in the angular context.
Any ideas on how to add an authorization header to a receive request?
source
share