Skip to content

feat(auth): support async MapKit token providers#84

Open
iloveitaly wants to merge 2 commits into
Nicolapps:mainfrom
iloveitaly:async-token
Open

feat(auth): support async MapKit token providers#84
iloveitaly wants to merge 2 commits into
Nicolapps:mainfrom
iloveitaly:async-token

Conversation

@iloveitaly

Copy link
Copy Markdown

Motivation

MapKit JS can request a new JWT throughout a session, but mapkit-react only accepted a static string, so short-lived server-minted tokens and mid-session refresh were awkward or unsupported.

Description

  • Widen token to string | (() => string | Promise<string>) and resolve it in the loader’s authorizationCallback whenever MapKit asks for credentials.
  • Keep the default loader’s provider in sync with the latest token prop via a ref (for re-auth after init without re-creating the map).
  • Document the API, mark authorizationCallback supported in support.md, and add a Storybook example using an inline async provider.

Test

  • Manual: string token still loads maps; async provider story returns a JWT and loads MapKit.
  • No automated tests (project has none).

Links

Fixes #3

- Update `loader` to support `authorizationCallback` requests occurring after the initial map load.
- Ensure the `Map` component keeps the loader's token provider synced with current props.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support token callbacks

1 participant