Skip to content

401 Error with Mapbox Marker URLs and Issues Overriding _getMarkerUrl #116

Description

@pgshehata

Problem Overview

I have been experiencing an issue with marker icons in Leaflet StyleEditor that utilize the URL https://api.tiles.mapbox.com/v3/marker/pin-s-circle+f39c12.png. Recently, these requests have started returning a 401 Unauthorized error. To address this, I need to include a Mapbox access token in the marker icon URLs.

I attempted to override the _getMarkerUrl method in L.StyleEditor.marker.DefaultMarker to customize the URL and include the access token, but my override does not seem to be taking effect.

Approach Taken
Here's the code I used for overriding the method:
L.StyleEditor.marker.DefaultMarker = L.StyleEditor.marker.Marker.extend({ _getMarkerUrl: function(size, color, icon) { // My custom logic here var url = 'https://my.custom.url/'; // Building the URL based on size, color, and icon parameters return url + 'some-path'; } });
Additional Context
I've ensured that this override is placed after the Leaflet and Leaflet StyleEditor scripts are loaded and before any map initialization.
The Mapbox access token is valid and works for other Mapbox API requests.

Assistance Required
I am seeking guidance or suggestions on how to properly override the _getMarkerUrl method to include the access token in the marker icon URL or any alternative solutions for addressing the 401 error with Mapbox marker URLs.

Thank you in advance for any help or insights you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions