mapbox / mapbox/mapbox-maps-flutter

Support setting custom HTTP headers before Map initialization

Open
#1,062 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

We can set custom HTTP headers via setCustomHeaders(...), but we can only do that inside the onMapCreated callback (after obtaining the MapboxMap instance).
However, this timing is too late: the initial network requests (style / glyph / sprite / tile) are already fired before setCustomHeaders done, so those first requests never include our custom headers.

We’d like to define custom headers before any Maps API object is constructed — similar to how we set the access token with MapboxOptions.setAccessToken(...).

Rationale

Some servers require custom auth headers for all map traffic

Enterprise / B2B applications often need to identify the app / org via headers

Prevents the “first request goes out without headers” problem

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing setCustomHeaders(...) from the onMapCreated callback and compare it with the earlier MapboxOptions.setAccessToken(...) configuration path. Identify where the Maps API object is constructed and determine how headers must be configured before the initial style, glyph, sprite, and tile requests. Done means custom headers are available on those first requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.