Loading Image in JavaScript with Bearer token
<p>I am loading an image in JS like this:</p>

<pre><code>var img = new Image();
img.onload = function () {
..
};
img.src = src;
</code></pre>

<p>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.</p>

<p>This is an <em>angular</em> 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. </p>

<p><strong>Any ideas to how I can add the Authorization header to the get request?</strong></p>