401 Unauthorized : while accessing image file from server folder
See original GitHub issuewhile loading below url I am getting 401 error http://localhost:35360/App.Service/CommonFiles/bbmri-53323851
in the cornerstoneWADOImageLoader.configure i am passing this parameter
cornerstoneWADOImageLoader.configure({
beforeSend: function(xhr) {
// Add custom headers here (e.g. auth tokens)
const apiKey = 'Bearer: WxVlvpBY4wYqSe-S_sfwXy7kxTd4u1Xk_OHIcV8YBMjtmyBAIDIKxXxfZs_pRaVU2sILLSy6qH8ZQy5yXcBUMaUvaiyXbcW-pyn9LB1o-EJcO2i33-adX468Eq6v_D3qO9hThVX7bOpX-P9z7_5Jk7DRG_75tZG-UbdEUcSFrvF0FjULdFyjhLeqdILxYd1j5705rv5CX8zl5BEqvZ3PLLwfdpKsAyTmJ2O3YXGVpk0uZLYKICH-joUhZlDCgR69kXG1E7DLtfnr7zwDfknFfm2qLgr8tl1M91iT4TzN71CNYD9fh2FaU9OAc1yZERBwiOGSpbr5E_A7vf3k0qPbaFS-tvD_KBJYYOxTawNpBCrLkwGYKYTDATRDLO3SREDhxSvUaWTnBNPdfKW8e9J8EXN4XZXz7ZocRBa0BHAwxFpc5iLIz2aOemTosZmRFFbAFXPqbSWEAIhIY8dXjwJlaRhZhIYxgsOBTj5kUG3_3Km1oKSUlFLvZaineU0fZjl2dj1rEas9icUho6tbNbRuIVpCmdfvYZKL0p5xXfVr0jloNM-WVbh6OCaW-cgCKQhIfDGkeisAGqAcqXxN5Rpeqon2xvbvE9GwZ96a9vLuBzVtdsa-0FIfRCfWj8GnB9tHpO7pOZ1XdSTh-o-oueRHng942WcWJqpWlehJrbaHsWsVzY-BaHAlbRmXlQ0p1TutbT5PCtWBoE4oWbXVQ3BDAuR-v1_vaY0ERTCDLA5wwVgaRZ8_';
if(apiKey && apiKey.length) {
xhr.setRequestHeader('APIKEY', apiKey);
xhr.setRequestHeader('content-type', 'application/dicom');
}
}
});
const baseUrl = 'http://localhost:35360/App.Service/CommonFiles/'
const series = [
'bbmri-53323851'
]
const imageIds = series.map(seriesImage => `${scheme}:${baseUrl}${seriesImage}`);
var element = document.querySelector('.cornerstone-element');
cornerstoneTools.init();
cornerstone.enable(element);
cornerstone.loadImage(imageIds[0]).then((image) => {
cornerstone.displayImage(element, image)
})
this is my code what is I am missing in it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Asp.net Images are giving 401 unauthorized error randomly
images are under a virtual folder. Everytime I hit refresh of the browser, some of the images gives 401 unauthorized error. (images and...
Read more >401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error is triggered by unauthenticated requests made to a WordPress web server. Learn how to identify and fix the issue....
Read more >HTTP 401 Unauthorized Error | What Is and How to Fix?
401 Unauthorized Error is an HTTP response status code indicating the request sent by the user couldn't be authenticated.
Read more >Troubleshoot 401 – Unauthorized: Access is denied due to ...
The primary cause of the 401 – Unauthorized: Access is denied due to invalid credentials error is that you are using a custom...
Read more >Get 401 Unauthorized error for images and js files - MSDN
I get 401 Unauthorized error for most images, CSS and js files in my ASP.NET web application. IIS_IUSRS has read & execute permissions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pmd23, unfortunately I’m not sure what to tell you. The issue appears to be on your server’s end. You’re setting a header named
APIKEY
with a bearer token set. Servers often expect anAuthorization
header? Maybe you should consult the documentation of the solution you’re integrating with.@dannyrb Yes man you correct its issue related to server-side which is from the end. Thanks for giving time for an answer and really wonderful lib.