An API key has been configured to access the web map with item-level access privileges in an ArcGIS Enterprise deployment secured with IWA. However, when I attempt to access the web map by passing the API key through the token parameter, a Windows Authentication login prompt still appears asking for credentials. I need to know how to suppress this IWA prompt so that the API key can be used directly to access the item. We are using the ArcGIS Maps SDK for JavaScript 4.33 and ArcGIS Enterprise 11.5.
My current code looks like this:
esriConfig.apiKeys.scopes = [
{
// The API key value
token: apiKey,
// An array of URLs that the API key applies to
urls: [portalUrl]
}
];
const webmap = new WebMap({
portalItem: {
id: "<itemid>",
portal: {
url: portalUrl
}
// apiKey: apiKey
},
});
await webmap.loadAll();
But this throws the error:
message: "Failed to load portal item"
name: "webmap:load-portal-item"
How are API keys expected to work with ArcGIS Enterprise secured using IWA?