map-specific access token - #8364
Conversation
| t.end(); | ||
| }); | ||
|
|
||
| // t.test('map-specific token', (t) => {\ |
There was a problem hiding this comment.
How can we instantiate a map with a bad token?
Would like to add a test for the positive case, where it starts with mapboxgl.accessToken = badtoken but gets overwritten by a valid token inside the map options.
There was a problem hiding this comment.
How can we instantiate a map with a bad token?
The unit tests don't exercise any access token specific logic.
Map options are set-only with no ability to read back to options that were used to instantiate a map object. Since the access token is passed through to the RequestManager unit tests are probably suited to the behavior of that class.
| t.end(); | ||
| }); | ||
|
|
||
| // t.test('map-specific token', (t) => {\ |
There was a problem hiding this comment.
How can we instantiate a map with a bad token?
The unit tests don't exercise any access token specific logic.
Map options are set-only with no ability to read back to options that were used to instantiate a map object. Since the access token is passed through to the RequestManager unit tests are probably suited to the behavior of that class.
|
bit stumped by the no-unused-vars lint error -- the flagged variable is used at https://github.com/mapbox/mapbox-gl-js/pull/8364/files#diff-3bdcadb35be47763a1abccc9707d22e0R375 |
asheemmamoowala
left a comment
There was a problem hiding this comment.
@ryanhamley @peterqliu IS there a reason to separate the implementation of the normalize...URL methods from the RequestManager? This PR would be a lot simpler if those were flattened, and all access to a token was through a RequestManager#accessToken() method.
| }, | ||
|
|
||
| set baseApiUrl(url: string) { | ||
| console.log('setting'); |
@asheemmamoowala I'm not sure I follow. the |
Why do the methods need to exist outside the
The |
asheemmamoowala
left a comment
There was a problem hiding this comment.
There is one instance of config.ACCESS_TOKEN in src/ui/attribution_control.js that needs to be updated to reference the map-specific access token as well.
|
Ohhh I get what you're saying @asheemmamoowala. Yes, they could be moved into the |
|
sounds like something we could tackle in a future PR 👍 @asheemmamoowala @ryanhamley do you see any other blockers to this one? |
|
Agreed that we can refactor in a separate PR Did you see Asheem's comment above @peterqliu?
|
|
👍 done ^ |
Launch Checklist
solves #6331
Adds an
accessTokenparameter to Map options, that optionally overwrites the token specified in mapboxgl.accessToken for just that map.