The request headers aren't being sent on MapImageLayers. but works with FeatureLayers
token = 'sometoken';
api = 'myproxyserver';
esriConfig.request.interceptors.push({
urls: [`https://${api}v1/GIS/proxy`],
before: (params) => {
params.requestOptions.headers = {'Authorization': 'Bearer ' + token};
},
headers: {'Authorization': 'Bearer ' + token}
});looks like it's not being sent with the fetchImage function within MapImageLayer.js ...
I think this is related to the responseType of the esriRequest:
When this value is image the headers and timeout options are ignored.
esriRequest - RequestOptions - responseType
request | API Reference | ArcGIS API for JavaScript 4.9
If this is the case, we will consider making an enhancement at a future release.
Hi Nathan, looks like we have this fixed for the upcoming 4.10 release, due out in mid-December. The "headers" will now be honored when the value type is "image". Hope this helps.
-Noah