Skip to main content

I am using Arcgis sdk for js 4.xx  for my web app. My idea is to add planet basemap using wmts layer.

const planetApiKey = "myPlanetApiKey"
const activeLayerId= "mySelectedBasemap"
            const custom_params = {
              api_key: planetApiKey
            }
            const wmtsLayer = new WMTSLayer({
              url: `https://api.planet.com/basemaps/v1/mosaics/wmts?`, // url to the service
              activeLayer: {
                id: activeLayerId,
              },
              customParameters: custom_params
            });
           
            // Add the layer to the map
            map.add(wmtsLayer);

 

 this will, of course, expose my Api Key on my client side, Is there a way to hide my credentials using this approach ?,
Thanks in advance.

Hey @daniel1uno, our recommendation is that you create a reverse proxy to hide your API key.  You can find a bit more information in our documentation about our tile services here. I see that you are also using the WMTS service - we recommend that you proxy the XYZ service instead. The WMTS metadata may include your API key in it, even when using a proxy service.


Reply