In our system, our users' accounts each have their own Google Maps API Key and admins can hop between accounts. Currently, the first time an admin looks at a Google Map in our system, the API Key of the account they were in at the time gets loaded up and when they switch to a different account, that same API Key continues to get used.
We're using lazy loading, like this:
<div id="mapwrap"
map-lazy-load="https://maps.google.com/maps/api/js"
map-lazy-load-params="{{mc.vm.mapUrl}}&libraries=places,geometry&hl=en">
<ng-map id="map_canvas"
map-type-id="{{mc.initMapType}}"
lazy-init="true">
...
</ng-map>
</div>
When the user changes accounts the mapUrl variable is getting updated but when using the Google Maps features, it still counts against the original account's quota and, perhaps more importantly, if the original account's api key had expired, you still get an "expired key" error and the map won't even load.
As far as I can tell, what's happening is that the lazy load system loads a script file strictly associated with that key only once. It never goes away and never tries another load until the whole web app gets refreshed.
Is there any way around this?