Hi,
I am trying to change my TypeScript app that uses the JS SDK version 4.24 to use one of the new API keys, since its previous API Key is now legacy. I haven't changed anything except the API key, and now I get `498 Invalid Token` on every request.
I also tried the advice from this post and used my new API key in the suggested tutorial in the documentation. It doesn't work there either, but my old legacy API key does.
Any ideas? Thanks in advance.
Solved! Go to Solution.
I believe it was created with an Esri Location Platform account. I did finally get the base map working by adding updating the referers I set on the key, but I still could not get the feature layers to load.
I finally tried adding `?f=pjson` to the feature layer URL, and then it worked. I then tried it again without the extra parameter, and it loaded. So I'm not sure why it required it to work or why it then worked when I removed the parameter. 🤔
But I have a functioning map now. Thank you for reaching out anyways!
Molly
oops forgot to show part of my code
import esriConfig from '@arcgis/core/config';
import Map from '@arcgis/core/Map';
import MapView from '@arcgis/core/views/MapView';
esriConfig.apiKey = "xyzxy";
//creates the map
const map = new Map({
basemap: "arcgis-light-gray", // Basemap layer service
});
//creates the MapView
const view = new MapView({
map: map,
center: [-98.0932, 38.232], // Longitude, latitude
zoom: 4, // Zoom level
container: 'viewDiv', // Div element
popup: {
autoOpenEnabled: false
}
});
Can you just confirm what you used to create the legacy and the new API key?
There's still a bit of confusion about the API keys - was the new one generated from a Esri Location Platform account?
I believe it was created with an Esri Location Platform account. I did finally get the base map working by adding updating the referers I set on the key, but I still could not get the feature layers to load.
I finally tried adding `?f=pjson` to the feature layer URL, and then it worked. I then tried it again without the extra parameter, and it loaded. So I'm not sure why it required it to work or why it then worked when I removed the parameter. 🤔
But I have a functioning map now. Thank you for reaching out anyways!
Molly