Hi everyone,
I'm running the Display a map sample in CodePen.
https://developers.arcgis.com/javascript/latest/tutorials/display-a-map/
All the code in CodePen is exactly identical to the tutorial, except the part apiKey: "YOUR_ACCESS_TOKEN" was replaced with my API key.
The API key was generated on Location Platform. Expiration date is 12/31/2025, and the referrers just contain one item which is https://codepen.io/
Error message shown in CodePen console is as follows. What could be problems with the API key, and how to fix the error?
"[esri.Basemap]" "#load()" "Failed to load basemap (title: 'Basemap', id: '194b4471ad7-basemap-0')" // [object Object]
{
"name": "request:server",
"message": "Token Invalid.",
"details": {
"url": "https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps/arcgis/topographic",
"requestOptions": {
"query": {
"language": "en",
"places": null,
"worldview": null,
"token": "AAPTxy8BH1V***********"
},
"signal": {}
},
"ssl": false,
"httpStatus": 498,
"messages": [
"The required authentication information is invalid. The token is either invalid or has expired."
],
"raw": {
"code": 498,
"message": "Token Invalid.",
"details": [
"The required authentication information is invalid. The token is either invalid or has expired."
],
"restInfoUrl": "https://basemapstyles-api.arcgis.com/arcgis/rest/info"
}
}
}
Solved! Go to Solution.
Actually I can replicate this and it's an issue with the referer. When I look at the request in the console that gets blocked it's getting sent from
Hi @Wehara , When you created your API key did you assign it the location services basemap privilege? https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/tutor....
Actually I can replicate this and it's an issue with the referer. When I look at the request in the console that gets blocked it's getting sent from
Hi @Sage_Wall
Thank you very much. Update the referrer then it's ok now.