<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problems with API key in MapLibre:  401 / invalid token in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/problems-with-api-key-in-maplibre-401-invalid/m-p/1681287#M685</link>
    <description>&lt;P&gt;I'm just starting with MapLibre and ESRI, and can't get it to recognize my api key.&lt;/P&gt;&lt;P&gt;My api key has basemap and basemap styles privileges.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the simple tutorial code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;apiKey = '&amp;lt;api key&amp;gt;';

const map = new maplibregl.Map({
  container: "map", // the id of the div element
  zoom: 2, // starting zoom
  center: [-20, 30] // starting location [longitude, latitude]
});

const basemapStyle = maplibreArcGIS.BasemapStyle.applyStyle(map, {
  style: "arcgis/outdoor",
  token: apiKey
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It generates url&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/outdoor?f=json&amp;amp;echoToken=false&amp;amp;token=AAPT&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But returns 401 / invalid_token error.&amp;nbsp; The key is valid.&amp;nbsp; Any ideas on how to debug this?&lt;/P&gt;</description>
    <pubDate>Sat, 31 Jan 2026 15:54:55 GMT</pubDate>
    <dc:creator>hess8</dc:creator>
    <dc:date>2026-01-31T15:54:55Z</dc:date>
    <item>
      <title>Problems with API key in MapLibre:  401 / invalid token</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/problems-with-api-key-in-maplibre-401-invalid/m-p/1681287#M685</link>
      <description>&lt;P&gt;I'm just starting with MapLibre and ESRI, and can't get it to recognize my api key.&lt;/P&gt;&lt;P&gt;My api key has basemap and basemap styles privileges.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the simple tutorial code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;apiKey = '&amp;lt;api key&amp;gt;';

const map = new maplibregl.Map({
  container: "map", // the id of the div element
  zoom: 2, // starting zoom
  center: [-20, 30] // starting location [longitude, latitude]
});

const basemapStyle = maplibreArcGIS.BasemapStyle.applyStyle(map, {
  style: "arcgis/outdoor",
  token: apiKey
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It generates url&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/outdoor?f=json&amp;amp;echoToken=false&amp;amp;token=AAPT&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But returns 401 / invalid_token error.&amp;nbsp; The key is valid.&amp;nbsp; Any ideas on how to debug this?&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jan 2026 15:54:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/problems-with-api-key-in-maplibre-401-invalid/m-p/1681287#M685</guid>
      <dc:creator>hess8</dc:creator>
      <dc:date>2026-01-31T15:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with API key in MapLibre:  401 / invalid token</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/problems-with-api-key-in-maplibre-401-invalid/m-p/1681353#M686</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/968224"&gt;@hess8&lt;/a&gt;&amp;nbsp;it really looks like your API key is no good. Check your settings and verify you have the required privilages, expiration date is in the future, and if you have any referrers set to make sure they match your origin.&lt;/P&gt;&lt;P&gt;If I run your URL above with my API key the service responds with 200, so you can use this technique to test your api key&lt;/P&gt;&lt;P&gt;&lt;A href="https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/outdoor?f=json&amp;amp;echoToken=false&amp;amp;token=AAPT.." target="_blank"&gt;https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/outdoor?f=json&amp;amp;echoToken=false&amp;amp;token=AAPT..&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If you do not get it work work can you post the server response JSON here it might provide additional information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Feb 2026 18:46:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/problems-with-api-key-in-maplibre-401-invalid/m-p/1681353#M686</guid>
      <dc:creator>John-Foster</dc:creator>
      <dc:date>2026-02-01T18:46:47Z</dc:date>
    </item>
  </channel>
</rss>

