MapLibre and Mapbox
All the examples use maplibre() with free basemaps, so
they run without an account or token. Everything also works with
mapboxgl(): create the map with your own Mapbox token as
usual in mapgl. maplore never reads or stores tokens.
If you use Mapbox, your token is exposed
Any map made with mapboxgl() includes your Mapbox token
in the HTML, with or without maplore: the browser needs it to load the
map, so anyone who opens the page can find it. Mapbox designs public
tokens for this, but someone could use yours and spend your quota. To
publish Mapbox maps:
- use a public token (
pk.…), never a secret one (sk.…); - create a separate token for published maps, because the default public token cannot be restricted, and restrict it to your site’s URLs in your Mapbox account;
- keep tokens in
.Renviron, out of version control.
To avoid tokens altogether, use maplibre() with a free
basemap. See Mapbox’s guide
on using Mapbox securely.