I'm trying to use the esriConfig.request.interceptors to attach a token for a secured service which works until I try to fetch the legend info for the same url base.
esriConfig.request.interceptors.push({
urls: "https://gis.wgfd.wyo.gov/arcgis/rest/services/OneSteppe/OneSteppe_ExistingDisturbance_WyGISC/",
before: function (params) {
params.requestOptions.query = params.requestOptions.query || {};
params.requestOptions.query.token = "theToken";
},
});
The fetch I'm using:
fetch('https://gis.wgfd.wyo.gov/arcgis/rest/services/OneSteppe/OneSteppe_ExistingDisturbance_WyGISC/MapServer/legend?f=json').then(function (response) { return response.json() }).then(function (legend) {console.log(legend)})
error is 499 "Token Required".
Thanks in advance for any help.
Jason.