I am loading an image in JS like this:
var img = new Image();
img.onload = function () {
..
};
img.src = src;
This will work, but I have realized that I must secure my images on the server side with OAuth 2 (as with the rest of the application) and this will effect in me simply receiving a 401 Unauthorized.
This is an angular app and I do have an interceptor adding the Authorization header consequently for all the angular service requests to the server, but in this case of course - the interceptor is not used because the call is not made in an angular context.
Any ideas to how I can add the Authorization header to the get request?