Closed IoTGirl closed 6 years ago
You should only need to specify your key in the map script URL. Ensure you haven't left out any characters in your Bing Maps key and make sure you did not include the square brackets.
The second method you mentioned is the old way of specifying a key. It works too, but it then requires you to set the key on each individual map instance you load on your page which will generate a transaction for each map instance (some people load multiple maps on a page). Specifying the key in the map script URL will only generate one map session transaction, regardless of how many map instances are on the page, and will also allow the team to move your account to a previous release version if there is an issue with a release.
Hi @rbrundritt,
I used the identical key in both places but I believe the issue is LocalHost not supporting your URL line based key. Did you try launching any *.HTML sample locally with only the URL based key? This continues to fail for me.
Note that I also went an downloaded a second key and the issue reproduced the same way so I don't believe your typo assumption is valid.
Either way, I was able to move forward using the old but functioning method and have already completed the rest of the request.
Sincerely, IoTGirl
Hi @rbrundritt
I am using these samples on localhost and kept getting the "Your credentials are not valid" message in the middle of all of the samples until I made one small change.
You show:
<script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=[**YOUR_BING_MAPS_KEY**]' async defer></script>
After some searching I found I needed this in GetMap as well:
map = new Microsoft.Maps.Map('#myMap', { credentials: '[**YOUR_BING_MAPS_KEY**]' });
Then the message went away so can you tell me if I have a configuration problem that the second instance of the key is required? I have it in both places at this point.
Sincerely, IoTGirl