I was going through this particular tutorial:
https://developers.arcgis.com/calcite-design-system/tutorials/create-a-mapping-app/
And it's got the information about using api keys. I built an api key for my test app (using vite) and after I setup the information to allow use of my enterprise portal (which is on version 11.4) and using 4.33 api, it's still prompting me for a login, even though I've selected the items in the webmap that I'm using the key to authenticate for. Here's my current page code (remember this is to test api key authentication):
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Calcite Web Map</title>
<script src="https://js.arcgis.com/calcite-components/3.2.1/calcite.esm.js" type="module"></script>
<script src="https://js.arcgis.com/4.33/"></script>
<link rel="stylesheet" href="https://js.arcgis.com/4.33/esri/themes/light/main.css" />
<script type="module">
const esriConfig = await $arcgis.import('@arcgis/core/config.js')
esriConfig.portalUrl = '<my enterprise portal>'
esriConfig.apiKey = '<my api key>'
</script>
<script type="module" src="https://js.arcgis.com/4.33/map-components"></script>
</head>
<style>
html,
body,
#webMap {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
display: flex;
}
</style>
<body>
<arcgis-map id="webMap" item-id="4f48ecb117874273a5f3a8bdc4d440f5">
<arcgis-zoom position="top-right"></arcgis-zoom>
</arcgis-map>
</body>
</html>
Thoughts? I've been dealing with this all day and have been waiting for api keys to be available to enterprise users for authentication purposes for a while now.
Thanks!
Dean Wilson